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