#include \"stdafx.h\"
class Person;
typedef void (Person::*PPMF)();
// error C2159: more than one storage class specified
typedef static void (Person::*PPMF2)();
If the function is static it does not require a (implicit) this pointer to be invoked. Therefore, a pointer to a static member function is not the same as a member function pointer:
#include "stdafx.h"
class Person;
typedef void (Person::*PPMF)();
typedef /*static*/ void (*PPMF2)();
class Person
{
public:
static PPMF verificationFUnction()
{
return &Person::verifyAddress;
}
PPMF2 verificationFUnction2()
{
return &Person::verifyAddress2;
}
private:
void verifyAddress() {}
static void verifyAddress2() {}
};
int _tmain(int argc, _TCHAR* argv[])
{
Person scott;
PPMF pmf = scott.verificationFUnction();
(*pmf)();
return 0;
}
EDIT:
removed the offending static from the typedef.