+ 1
Classes
when creating a class is it better to create it on a seperate header file and an implementation source code, or have it all on one source code? Any particular reason you would chose one over the other?
3 Respuestas
+ 2
Splitting your source code is a good practice because if you change something in One file, you dont need to recompile everything, just the changed file. it is also a good practice to keep the Header files simple, that means that the most includes are done in the cpp. Note that you can define multiple cpp for one Header/class (possibility to Split definitions in multiple cpp). but sometimes it is needed to define a class just in the cpp, to keep it private. it is possible to include a cpp file, but this is very bad practice.
never do a using Namespace inside a Header!
0
Yes i think this is good approach to make seperate header file for executing task for smoother execution at run time.
Simply your main should not take all the load of code you've made divide task make classes and use them wisely
0
in header:
looks better,
easier to understand
in source:
works faster