M
Marco
Can I call the overridden version of an object's foo() method
outside that object's class, without using super? EG:
class MainProgram {
public static void main(String[] args) {
Beta b = new Beta();
// I want to invoke Alpha.foo() but on the Beta instance.
// I want to cancel the dynamic binding that makes Beta.foo()
// get called instead
// b.super.foo() <---- obviously doesn't compile
}
}
class Alpha {
public void foo() { System.out.println("inside Alpha.foo()"); }
}
class Beta extends Alpha {
public void foo() { System.out.println("inside Beta.foo()"); }
}
Is this possible?
Marco
outside that object's class, without using super? EG:
class MainProgram {
public static void main(String[] args) {
Beta b = new Beta();
// I want to invoke Alpha.foo() but on the Beta instance.
// I want to cancel the dynamic binding that makes Beta.foo()
// get called instead
// b.super.foo() <---- obviously doesn't compile
}
}
class Alpha {
public void foo() { System.out.println("inside Alpha.foo()"); }
}
class Beta extends Alpha {
public void foo() { System.out.println("inside Beta.foo()"); }
}
Is this possible?
Marco