package net.betterjava.design.override;
/**
* override sample, Child override Base.Iam(Base) method
*/
public class Base {
void Iam(Base b) {
System.out.println("Base;Overload");
}
void Iam(Child c) {
System.out.println("Child;Overload");
}
public static void main(String[] args) {
Base[] test = new Base[] { new Base(), new Child()};
for (int i = 0; i < test.length; i++)
test[i].Iam(test[i]);
}
}
class Child extends Base {
void Iam(Base b) {
System.out.println("Base;Override");
}
}