So I have a vector full of all the objects for my game; things like the player object, enemy object, walls, etc... All things in the vector are children of Framework
, so I made the vector type Framework
because that was the closest thing to a universal data type for them.
The problem was it wasn't running overridden functions from the objects it stored. So I Googled it to find out apparently I'm object slicing by storing them as Framework
. So my question is then, how do store all these objects in one list?
Just for reference, this is where the supposed-to-be-overridden functions are called.
for (vector<Framework>::iterator num = gameObjects.begin(); num != gameObjects.end(); ++num)
{
//The current thing
Framework currentObject = *num;
currentObject.frameEvent();
currentObject.frameEndEvent();
currentObject.drawEvent();
}
Thanks in advance.