I am writing a game where a certain location will point to a creature which resides there and also the creature points to the location where it is located. I am running into problems however because when I declare the location class and add as one of its members a pointer to an as of yet undeclared class creature it gives me an error. Is there any way to make this work? I've rewritten the relevant code and posted it here.
So the problem basically is that I'm trying to create a pointer to a class that doesn't exist yet.
Anyone have any ideas?
Gives the error message:
using namespace std;
creature *pCreature; // CLASS CREATURE IS AS OF YET UNDECLARED! //
dog.pLocation = &newLocation;
newLocation.pCreature = &dog;
12 C:\Dev-Cpp\newTemp.cpp ISO C++ forbids declaration of `creature' with no type
12 C:\Dev-Cpp\newTemp.cpp expected `;' before '*' token