Why does my C++ subclass need an explicit constructor?

后端 未结 3 1216
南笙
南笙 2021-02-19 19:12

I have a base class that declares and defines a constructor, but for some reason my publicly derived class is not seeing that constructor, and I therefore have to explicitly dec

3条回答
  •  攒了一身酷
    2021-02-19 20:03

    Constructors are not inherited. You have to create a constructor for the derived class. The derived class's constructor, moreover, must call the base class's constructor.

提交回复
热议问题