【发布时间】:2013-12-17 23:49:38
【问题描述】:
我有以下内容:
typedef void(*ptrFcn)(); //also I tried typedef void(B::*ptrFcn)()
class A {
....
void call(ptrFcn Fcn);
...
}
到这里为止,没有问题..一个简单的类的定义
class B{
A var;
...
void theFunction(); //until here, there is no problem
void theCurse(); //this is the problem
}
----- B.cpp -------
void B:: theCurse(){
//a lot of instructions
//here, I need to invoke theFunction without be a static function
var.call(theFunction); //<--- wrong
}
所有这些说明都可以在不使用类的情况下工作,但两个类都是强制性的:(我使用的是 Visual Studio 2012。
谢谢你:)
【问题讨论】: