Cross-Referencing Classes
I have two classes: mRoom and mDoor. mRoom has an array of 10 mDoors in it, and mDoor has 2 pointers which hold the adjacent mRooms. I can't seem to get this into code.
NOTE: the main cpp file is just has the #include and a blank main function, with a return 0 statement.
Here's the header file:
Code:
#ifndef MSOLVE_H_
#define MSOLVE_H_
class mRoom
{
private:
mDoor exits[10];
public:
mRoom( );
~mRoom( );
};
class mDoor
{
private:
mRoom * adjRooms[2];
public:
mDoor( );
~mDoor( );
};
#endif
And here are the errors:
Code:
--------------------Configuration: RoomMazeSol - Win32 Debug--------------------
Compiling...
main.cpp
c:\c++\roommazesol\msolve.h(7) : error C2146: syntax error : missing ';' before identifier 'exits'
c:\c++\roommazesol\msolve.h(7) : error C2501: 'mDoor' : missing storage-class or type specifiers
c:\c++\roommazesol\msolve.h(7) : error C2501: 'exits' : missing storage-class or type specifiers
Error executing cl.exe.
RoomMazeSol.exe - 3 error(s), 0 warning(s)