更新时间:2021-08-29 22:12:04
因为你的超级人
没有'在你的子类( Student
和 Staff
)中有一个默认构造函数,你必须调用超类构造函数第一个语句。
Since your super class Person
doesn't have a default constructor, in your sub classes (Student
and Staff
), you must call the super class constructor as the first statement.
你应该像这样定义你的子类构造函数:
You should define your sub class constructors like this:
Student() {
super("a_string_value", an_int_value);// You have to pass String and int values to super class
}
Staff() {
super("a_string_value", an_int_value); // You have to pass String and int values to super class
}