且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

为什么这个程序显示错误?类a中的构造函数a不能应用于给定类型

更新时间:2022-04-26 22:43:49

B类隐含地调用 super()但是A类中没有定义无参数构造函数。

您可以:

  • 调用例如, super(0,0); B 类构造函数
The B class implicitely calls super() however no argument-less constructor is defined in the A class.
You might either:
  • call, for instance, super(0,0); inside B class constructor
  • A 类中定义无参数构造函数
  • define a argument-less constructor in the A class