package polymophism;
public class Human {
public void eat() {
System.out.println("Human eat");
}
}
public class Woman extends Human {
public void eat() {
System.out.println("Woman eat");
}
}
public class Man extends Human {
public void eat() {
System.out.println("Man eat");
}
}
public class Tester {
public static void main(String[] args) {
Woman w = new Woman();
Man m = new Man();
Human hm = new Man();
Tester tester = new Tester();
tester.eat(m);
tester.eat(hm);
tester.eat(w);
}
private void eat(Human h) {
h.eat();
}
}