函数指针参数列表在类中

时间:2013-10-20 14:24:21

标签: c++ function class pointers

我有一个名为A的类,如下所示:

class A
{
  protected: typedef bool(*fp)();
  public: 
  virtual void back(fp succesor,fp valid,fp solutie,fp show); // this function is defined in the .cpp
};

和来自A的B类看起来像这样:

class B : public A
{
  public: 
  bool succesor(); //defined in cpp
  bool valid(); //defined in cpp
  bool solutie(); //defined in cpp
  bool show(); //defined in cpp
  void generate()
  {
    back(succesor,valid,solutie,nullptr);
  }
};

我没有向你展示构造函数和类的实例化,因为它在这个阶段并不重要。

我的想法是,当我将后退调用放入generate函数时,会给出这3个错误:

  1. 错误C3867:'B :: succesor':函数调用缺少参数列表;使用'& B :: succesor'创建指向成员的指针

  2. 相同但使用其他功能名称

  3. 相同但使用其他功能名称

  4. 拜托,你能告诉我我的错误在哪里吗?

    谢谢

0 个答案:

没有答案