Original Post
Hi, I always wondered what is the right thing to do in this situation. This is a quick example, the third inheritance makes no sense but it adds more context to the question.
As the hierarchy extends, the Draw function requires another parameter for the model to draw correctly. Is this correct OOP? What stops a user from using the parents draw function and therefore breaking the game?
class CModel
{
void Draw(CRenderer& _rRenderer);
}
class CPlayerModel : public CModel
{
void Draw(CRenderer& _rRenderer, const CVector3& _krPlayerPosition);
}
class CExamplePlayerModel : public CPlayerModel
{
void Draw(CRenderer& _rRenderer, const CVector3& _krPlayerPosition, void* _pAnotherParameter);
}
As the hierarchy extends, the Draw function requires another parameter for the model to draw correctly. Is this correct OOP? What stops a user from using the parents draw function and therefore breaking the game?