Partial overriding in Java (or dynamic overriding while overloading)
- by Lie Ryan
If I have a parent-child that defines some method .foo() like this:
class Parent {
public void foo(Parent arg) {
System.out.println("foo in Function");
}
}
class Child extends Parent {
public void foo(Child arg) {
System.out.println("foo in ChildFunction");
}
}
When I called them like this:
Child f = new Child();
Parent g…