It appears that since the StateManager class includes (Engine& engine), it might be getting involved with the actual 'Class Engine' functions.
I've been cycling through a few different single errors, I change something and a get an error, I change something else and I get a different error etc.
This is probably the source so can yall help me out?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
class Engine;
class StateManager
{
public:
StateManager(Engine& engine);
};
class Engine
{
public:
Engine();
StateManager Sta_Mgr;
};
Engine::Engine(){}
StateManager has no default constructor, Engine includes an instance of StateManager, and Engine's constructor doesn't explicitly call StateManager's constructor.
class Engine;
class StateManager
{
public:
StateManager();
StateManager(Engine& engine);
private:
Engine& theEngine;
};
StateManager::StateManager(){}
StateManager::StateManager(Engine& engine):
theEngine(engine){}
class Engine
{
public:
Engine();
StateManager Sta_Mgr;
};
Engine::Engine(){}
int main()
{
Engine Game;
}
I guess I need to initialize "theEngine", but I'm kind of confused.
Why do I need to initialize it? StateManager::StateManager(), it thought it is just meant to be an empty default constructor.
How exactly would I initialize it?
I thought it is supposed to be initialized when I start the program.