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

后端 未结 3 1197
南笙
南笙 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 19:59

    You have to construct your base class before dealing with derived. If you construct your derived class with non-trivial constructors, compiler cannot decide what to call for base, that's why error is occuring.

提交回复
热议问题