make
void func()
{
printf("run ");
}
into the follow static member function
static void func()
{
printf("run ");
}
And your syntax should be correct
or for a member function pointer try this
#include <iostream>
using namespace std;
class A;
typedef void (A::*PFN)();
class A
{
public:
void foo()
{
run(&A::func);
}
private:
void run(PFN pfn1)
{
((*this).*pfn1)();
}
void func()
{
printf("run ");
}
};