Call function from object instantiated in one class in another
- by Dk43
I have two classes, both of which need to be able to call the same instance of entitymanager
class Engine
{
EntityManager::Entitymanager EManager;
}
And I need to add an object to a vector contained by this particular instance of Engine. What I want to do is be able to add a bullet spawned by the player to the vector that contains all my entities.
class Player : Entity
{
void SpawnBullet() {Engine::EManager.Add(BULLET);}
}
The above returns this error:
error: object missing in reference to ‘Engine::EManager’
How do I resolve this? Any help or pointers in the right direction would be much appreciated!