+ 2
Is it possible to declare AND define classes in ONE header file?
Do we really need to create header and source files for all classes or can the declaration/defination be in one file?
5 Answers
+ 3
Yeah agree. And when you define functions in the header file they become automatically inline. That means these functions work faster than the ones defined separately. It is a good practice to define setters and getters in the header since they are used to access data and it will be fast
+ 1
Yes.. you can... mainly when you import a header what you are doing is like copy and pasting the code inside the header in the beginnig of your main code file where you called the import command... but the idea behind headers is that your code its no exposed to the user... just the class, methods, properties and fuction names.. you can pack your code in a dll format or someting similar and distributed with the header file.. that way, anyone can use it but nobody cann't mess with your code...
0
Yes you can.
0
Thanks for all the answers!
0
yes you can do that.