Cloning C++ class with pure virtual methods

后端 未结 4 770
北海茫月
北海茫月 2021-01-18 06:56

I have the following relation of classes. I want to clone the class Derived, but I get the error \"cannot instantiate abstract class\". How I can clone the derived class? T

4条回答
  •  醉梦人生
    2021-01-18 07:09

    You can not instantiate a class which has a pure virtual function like this:

    virtual void yourFunction() = 0
    

    Make a subclass or remove it.

提交回复
热议问题