So, we have
public abstract class A{
protected abstract String f();
}
public class B extends A{
protected String f(){...}
}
public class C extends A{
protected String f(){
A b = (A) Class.forName("B", true, getClass().getClassLoader()).newInstance();
return b.f();
}
This doesn't allow me to access b.f()
, saying that B.f()
is in the protected scope, however f
was protected by A
, and since C
extends A
, it should also get access to f()
.