我收到的确切错误是:
error C2064: term does not evaluate to a function taking 0 arguments
我正在尝试创建一个基本的逻辑门模拟工具。这只是基本逻辑的一部分,这是我这个规模的第一个项目。我在下面包含的是一个门类的代码,一个与门类将从这个基类继承属性。我的错误发生在函数指针调用处。
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;
}
};