error C2064: term does not evaluate to a function taking 0 arguments
我试图创建一个基本的逻辑门模拟工具。这只是基本逻辑的一部分,这是我这个规模的第一个项目。我在下面包含的是一个门类的代码,AND门类将继承这个基类的属性。我的错误发生在函数指针调用。
class gate
{
protected:
short int A,B;//These variables represent the two inputs to the Gate.
public:
short int R;//This variable stores the result of the Gate
gate *input_1, *input_2;//Pointers to Inputs
void (gate::*operationPtr)();
void doAND()//Does AND operation
{
R=A&&B;
operationPtr=&gate::doAND;
}
short int getResult()
{
operationPtr();//ERROR OCCURS HERE
return R;
}
};
2013-08-26
Kryptyle
+0
但是你确定成员函数指针真的是你想要的吗?具有虚函数的派生类不会以更简单的方式解决相同的问题吗? –
+0
我现在要实现这个改变,我会研究使用虚函数,尽管我对于如何去调用它们有点粗略。我会为此做一些功课。谢谢! –