Aside from adding a method explicitly on the subclass to call a super
method, is there anyway to "unhide" it temporarily? I would like to call the super.blah()
method on a Test2
instance. Must I use a method like originalBlah
, or is there another way?
public class TestingHiding {
public static void main(String[] args) {
Test1 b = new Test2();
b.blah();
}
}
class Test2 extends Test1 {
public void blah() {
System.out.println("test2 says blah");
}
public void originalBlah() {
super.blah();
}
}
class Test1 {
public void blah() {
System.out.println("test1 says blah");
}
}
Edit: Sorry to add to the question late in the game, but I had a memory flash (I think): in C# is this different? That it depends on which class you think
you have (Test1 or Test2)?