Cant say whether or not its considered good practice
but i think a better way to do it would be this:
1 2 3 4 5 6 7 8 9 10 11
int main()
{
Engine* engine = new Engine(); //Constructor initializes whatever needs to be initialized
//Ball is derived from object
Ball* ball = engine->CreateObject<Ball>(30); //engine creates & initializes object (which may include setting a reference to itself in the object), stores it, and returns a reference
delete engine; //engine is cleaned up which in turn cleans up all the objects
return 0;
}
if you have multiple engine objects and only want to initialize the graphics engine / hardware stuff once, you can do it with static as you did.
That said, I think you should also listen to Stav, or consider: the engine class may be better to keep apart from anything else. It should probably not draw anything or DO anything graphical, just handle the engine state and provide access to it. It may even be doable more cleanly as a singleton pattern if you follow this approach.