两个类:
class A
{
public:
// Construction
A();
virtual ~A();
// Attributes
public:
void (CWnd::*m_fpDragCol)(int&, int&);
void SetCallback(void (CWnd::*fpDragCol)(int&, int&));
......
};
SetCallback的实现如下:
void A::SetCallback(void (CWnd::*fpDragCol)(int&, int&))
{
m_fpDragCol = fpDragCol;
}
class B
{
...
void functon1();
void function2(int &source, int &dest);
}
functon1与functon2的实现如下:
void B::fucntion1()
{
A a = new A;
a->SetCallback((void (CWnd::*)(int&, int&))function2);
}
void B::function2(int &source, int &dest)
{
//do something
}
现在编译报错:
C3867 'B::function2': non-standard syntax; use '&' to create a pointer to member
请问大家问题出在了哪里