my first project in c++ (I use g++ on centos)
from Python and c#, I use to split my program into few files, each class in different file.
The most common reason i find, why use .h file, is because you can change the header code in the .cpp file, without affecting other people that uses that specific header. this feature is meaningless when using version control, where no one see the changes until you submit your code to the main project library. (#ifndef can still be used to prevent multiple main() and such errors)
Besides that, I cant find reason why I should use .h files to write classes in different files.
I can just use
#include "class1.cpp"
#include "class2.cpp"
I will get the same result as using .h file, without the need to maintain classes in two different files (.h + .cpp) (and without the complexity when using default values) As far as I understand, in both cases, the compiler will include the source code, as if it is one big source file. So.. why should I use .h (and .cpp) files and not just split my program into .cpp file instead ?