我有我的代码组织为以下复制指针成员函数从结构
class MyClass
{
public:
typedef void (MyClass::Ptr2func)();
}
struct abc
{
MyClass::Ptr2func ptr;
bool result;
}
void main()
{
MyClass myCls;
abc var;
//here is a lot of decision making code and pointer initializations
//I want to copy the pointer to function in another variable
MyClass::Ptr2func tempPtr;
tempPtr=var.ptr;
}
当我尝试复制var.ptr
到tempPtr
它给了我一个编译错误的参数列表丢失。它也给我编译错误myCls.*(var.ptr())
;有优先问题吗?我曾尝试使用括号,但没有任何工作。我希望有人能帮助我解决这个问题。
感谢和问候, 萨巴塔西尔
-1不是真正的代码 – 2014-02-10 13:10:17