Maze.h:
Expand|Select|Wrap|Line Numbers
- #ifndef MAZE_H
- #define MAZE_H
- ...
- using namespace std;
- class Maze {
- public:
- ...
- private:
- ...
- struct MazeThing {
- ...
- };
- struct MazePerson : public MazeThing {
- ...
- };
- struct MazeMonster : public MazeThing {
- ...
- };
- ...
- MazePerson person;
- MazeMonster monster;
- ...
- };
- #endif
Maze.h:
Expand|Select|Wrap|Line Numbers
- #ifndef MAZE_H
- #define MAZE_H
- ...
- #include "MazePerson.h"
- #include "MazeMonster.h"
- using namespace std;
- class Maze {
- public:
- friend class MazeThing;
- ...
- private:
- ...
- MazePerson person;
- MazeMonster monster;
- ...
- };
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef MAZETHING_H
- #define MAZETHING_H
- class Maze;
- class MazeThing {
- public:
- friend class Maze;
- protected:
- ...
- Maze *myMaze;
- ...
- };
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef MAZEPERSON_H
- #define MAZEPERSON_H
- #include "MazeThing.h"
- class Maze;
- class MazePerson : public MazeThing {
- public:
- friend class Maze;
- ...
- };
- #endif
Expand|Select|Wrap|Line Numbers
- #ifndef MAZEMONSTER_H
- #define MAZEMONSTER_H
- #include "MazeThing.h"
- class Maze;
- class MazeMonster : public MazeThing {
- public:
- friend class Maze;
- ...
- };
- #endif
invalid use of undefined type `struct Maze'
forward declaration of `struct Maze'
I've tried changing around the #includes and forward declarations, but I always get errors. Any help would be greatly appreciated.