class A
{
void Func();
typedef void (A::*FuncPoint)();
FuncPoint pFunc;
void Exec();
}
void A::Exec()
{
pFunc = Func;
pFunc();//报错 error C2064: term does not evaluate to a function
}
是什么原因啊????
{
void Func();
typedef void (A::*FuncPoint)();
FuncPoint pFunc;
void Exec();
}
void A::Exec()
{
pFunc = Func;
pFunc();//报错 error C2064: term does not evaluate to a function
}
是什么原因啊????
A::*FuncPoint???
怎么不见啊?
FuncPoint pFunc;??
指针吗?
(this->*)pFunc();
这样写
是这样调用
(this->*pFunc)();
A* a;
...
(a->*pFunc)();//貌似这里还是报错
class A
{
public:
void Func(){}
};
int main(){
A* a=new A;
void (A::*pFunc)() = &A::Func;
(a->*pFunc)();
}
{
public:
void Func(){}
};
int main(){
A a;
void (A::*pFunc)() = &A::Func;
(a.*pFunc)();
}