//--- socket.h
#include "player.h"
class Socket {
public:
...
private:
Player* player;
};
//--- player.h
#include "socket.h"
class Player {
public:
...
private:
Socket* sock;
};
... I get errors. Basically I am including player.h into socket.h in order to make a pointer to the Player class, however I am also including socket.h into player.h so that i can make a pointer to the Socket class. The problem is socket.h already includes player.h so I am effectively including player.h into player.h.. which is causing me compile problems.
So what would be the best way to do this? Basically I am trying to make an object of the Player class and Socket class to both have a pointer pointing at each other.