I'm having problems casting a function pointer. It works (no cast needed) outside a class.
Here is the signature of the function I'm calling.
Result* FancyClass::callMe(void(*functionPointer)())
It works with.
void defaultState()
{
//
}
// ..
Result *result= instance.callMe(defaultState);
But it does not work with
void MyClass::defaultState()
{
//
}
// ..
Result *result= instance.callMe(MyClass::defaultState);
I am getting this:
argument of type "void (MyClass::)()" is incompatible with parameter of type "void ()()"
How to cast this correctly?