0
About including functions in header file instead of source file .
Hi , in SL courses Ive learned how to create a header file , and include functions (void and none-void ones) . The first problem is that , I cannot use cout in the header file even if I include iostream . So I want to use none-void function and my main goal is to write my comolete code in the header file , not the source file . All I could use by now is to declare void func(); in header file and use code in source file like this : bool Myclass::func(int x){ if(x>1){ return 1; } else return 0; } Now can I use this block in the header file ? I dont know how to do it... it just occurs errors .
4 Respuestas
+ 1
Martin Taylor thank you👍
+ 1
You can create user-defined headerfile write code on normal file and save it as your headerfile name and use it but u have to use in doubles quotes not in angular bracket.
0
A.S. thanks 👍👍