我有一个名为 Person 的抽象类和一个名为 Employee 的扩展 Person 的子类。当我尝试编译时,我得到一个构造函数错误。我如何在 Employee 类中编写构造函数以便编译?如果您需要有关此问题的更多信息,请告诉我。谢谢你。
public abstract class Person { //Person abstract class
public String firstName;
public String lastName;
public char gender;
public Person(String fname, String lname, char g) { //constructor
firstName = fname;
lastName = lname;
gender = g;
}
public abstract void setDefaults();
}
public class Employee extends Person { //Employee class that extends Person
public Employee() { //i thought super(); might solve the problem, but it didnt.
super();
}
public void setDefaults() {}
}