Becase I've seen (and used) situations like this:
In header.h:
class point
{
public:
point(xpos, ypos);
int x;
int y;
};
In def.cpp:
#include"header.h"
point::point(xpos, ypos)
{
x = xpos;
y = ypos;
}
In main.cpp:
#include"header.h"
int main()
{
point p1(5,6);
return 0;
}
I know the program executes from main, but how does the compiler know what order to compile .cpp files? (Particularily if there are more than one non-main .cpp files).