私はこの状況にあります:
public abstract class ClassA{
public ClassA getClassOfSameKind(){
return this.getClass().newInstance();
}
}
public abstract class ClassB extends ClassA{
public void doSomethingSpecial(){
ClassB otherClass = (ClassB) this.getClassOfSameKind();
//do something special that only Class B can do
}
}
別の方法でやりますか?