avoiding compulsory call to superclass
I have an Animation class which is designed so that clients can create subclasses for their own custom animations. A client fills in the move logic of the animation in the Update function. But what every client *must* know is first to call the Update function of the superclass because there the time is updated that every animation needs.
Code:
/*virtual*/ Status CAnimation::Update(unsigned long ElapsedTime)
{
m_TimeElapsed += ElapsedTime;
return CONTINUE;
}
Status CWinlineAnimation::Update(unsigned long TimeElapsed)
{
Status RetVal = CONTINUE;
CAnimation::Update(TimeElapsed);
// ...... move logic
}
Is there a way that I can make sure that CAnimation::Update is called without forcing every client to remember calling Update first?