i have a BaseClass and a DerivedClass. i need the BaseClass to register a glut callback, but i need the DerivedClass to determine what the callback does.
heres the code:
(.h)
class BaseClass
{
public:
BaseClass();
~BaseClass();
protected:
static void _renderCallback(void);
virtual void Render();
};
(.cpp)
BaseClass::_renderCallback(void)
{
Render();
}
BaseClass::Render()
{
//override me in the DerivedClass !
}
i understand that if the callback is within a class, it must be declared as static, and it cannot be virtual. but of course i get compile time errors with this code -
"in function 'BaseClass::_renderCallback(void)':
cannot call member function 'BaseClass::Render' without object".
so how to enable the callback to call a function that can be overriden in the derived class?