Is some one able to explain why header files have something like this?
class foo; // This here?
class bar
{
bar();
};
Do you need an in
That's a forward declaration. Consider the following example:
class foo; // you likely need this for the code beneath to compile
class bar {
void smth( foo& );
};
If you haven't included the definition of class foo
in such a way that the compiler sees it before compiling the definition of class bar
the code will not compile (the compiler will say it doesn't know what foo
means) unless you have the forward declaration.