I have a class State and another friend class Game. My question is, if I have a class MenuState which extends State, is MenuState a friend of Game as well?
EDIT:
So if I have a situation like this:
class Game
{
private:
StateManager* myStateManager = new StateManager();
}
class State
{
public:
static void create(StateManager* Parent, const std::string name) {};
private:
StateManager* parent;
}
#define DECLARE_STATE_CLASS(T) \
static void create(StateManager* Parent, const std::string name) \
{ \
T* myState = new T(); \
myState->parent = Parent; \
Parent->manageState(name, myState); \
} \
class MenuState : State
{
public:
DECLARE_STATE_CLASS(MenuState)
}
int main()
{
Game app;
MenuState::create(This needs to be the stateManager in app, "MenuState");
app.init("MenuState");
}
How can I make this work without making the state manager public?