I would like to do this: Use reflection to invoke an overridden base method but
- have it done in java
- and when @Override has not been specified on the child method (this is for when I don't have access to the source)
I have:
package test;
public class A{
public String toString(){
return "A";
}
}
package test;
public class B extends A{
public String toString(){
return "B";
}
}
I want ((A)(new B())).toString()
to be "A", not "B". Is there a way to get this using reflection?