template <typename BaseType>
class Base
{
public:
typedefvoid (Base::*Callback)(int A);
void BaseMethod(Callback *method)
{
DerivedCallback();
}
};
class Derived : public Base<int>
{
public:
void DerivedCallback1(int A)
{
/* do stuff */
}
void DerivedCallback2(int A)
{
/* do stuff */
}
void DerivedMethod()
{
BaseMethod(DerivedCallback1);
BaseMethod(DerivedCallback2);
}
};
int main()
{
Derived d;
return 0;
}
The above is an example which does not compile. My compiler complains that the two BaseMethod() calls in DerivedMethod() are invalid uses of non-static member function.
Is this not possible to do, or is my syntax simply wrong? All I want is to be able to pass as an an argument to a method in the base class from the derived class some callback as a variable for the base class to invoke later.