What it the advantage of having your program organized as follows - just organization?
main.cpp - the main part of your program
object.h - the defitions for an object your program uses
object.cpp - the implementation for the object, based on the definitions in the object.h file
I've always just stuck the object's definitions AND the object's implementation in a .h file, then only had one .cpp file for my project, but I've noticed a lot of projects do it the way I mentioned above.
And how do I compile a program like I mentioned above - like this?
g++ main.cpp object.cpp -o main.exe
Also, what is the difference (with GCC) between
gcc main.cpp Person.cpp -lstdc++ -o main.exe
and
g++ main.cpp Person.cpp -o main.exe