更新时间:2022-06-11 22:01:27
由于您的超类 Person
没有默认构造函数,因此在您的子类 (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
}