Hi,
I have designed a class in C++ that has four pointers to its 'neighbours' in the world. Its neighbours are of the same class, so I have ended up with a class that has a reference to itself. Sorry for the poor explanation, the code will make it more obivous:
I can see why the compiler is upset with it, but I am unsure how to get round the problem. I could hold the 'neighbour' information outside the class if necessary, but the above approach would be most ideal. So any suggestions on how to code this?Code:class TerrainPatch { public: TerrainPatch(); ~TerrainPatch(); TerrainPatch* mNorthPatch, mEastPatch, mSouthPatch, mWestPatch; // <-- Problem };
Cheers for the help,
Skusey