Forward declaring a class let's you use the name of that class in a "generic" way. IE: you can use it:
1) As a return type to a function
2) You can use it as a function parameter
3) You can create a pointer or reference to it
However you
cannot use a forward declared class as a full object, because in order to do that the compiler needs to have the class fully defined. If you are doing any of the below, you will
need to #include the class's header:
1) Creating an object/instance of the class (such as your 'MAP' array)
2) Implementing a function which returns an object, or takes an object as a parameter
3) Dereferencing a pointer or reference
4) Doing a sizeof() or anything else that requires the size/contents of the class to be known.
Can some1 give me a run through of linkers and what to include and what to not and so on... |
This outlines it pretty well:
http://cplusplus.com/forum/articles/10627/