I have my Parent class which is:
public abstract class Employee {
protected String firstName;
protected String lastName;
protected String position;
protected ArrayList<String> skills;
protected ArrayList<Method> specialMethods;
public String toString() {
return "Name:" + firstName + " " + lastName + "\n" + "Position: "
+ position + skills.toArray(new String[0])+"\n"
+"Special Methods: "+ this.class.getMethods();
}
But I can not write this.class.getMethods()
in the Parent class, I have to write Employee.class.getMethods()
. I want to get the methods of a Child, whichi will inherit the toString()
method from Employee, but it will only return the parent methods this way.
Aucun commentaire:
Enregistrer un commentaire