我有我的代碼組織爲以下複製指針成員函數從結構
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