【问题标题】:inheritance c++, getting error when creating a constructor继承c ++,创建构造函数时出错
【发布时间】:2017-03-17 20:22:39
【问题描述】:

this is my code

and this are the error massages

它必须与默认构造函数做一些事情。我只是不明白错误是什么。

【问题讨论】:

    标签: inheritance constructor


    【解决方案1】:

    您正在为 Son 声明一个构造函数,但没有定义它。在main()中创建son对象时,会调用son的构造函数,必须定义。添加一个空的构造函数将解决这个问题。而不是

    son();
    

    写:

    son() { }
    

    您的错误消息将消失。

    【讨论】:

      猜你喜欢
      • 2019-01-21
      • 1970-01-01
      • 2020-08-13
      • 2012-11-14
      • 2021-06-24
      • 2015-03-24
      • 2014-08-21
      • 2017-08-09
      • 1970-01-01
      相关资源
      最近更新 更多