如何将成员函数指针转换为静态函数?
这是我的代码:
class ClassA
{
public:
int n;
void func();
};
void ClassA::func()
{
n = 89;
}
class ClassB
{
public:
float f1;
float f2;
void func(float f);
};
void ClassB::func( float f )
{
f1 += f;
f2 += f;
}
int main (int argc, char *argv[])
{
ClassA* a = new ClassA;
ClassB* b = new ClassB;
//PROBLEM IS HERE
void (* pf_func1)(void*) = ClassA.func;
void (* pf_func2)(void*, float) = ClassB.func;
pf_func1(a);
pf_func2(b, 10);
}