I have the following class:
public class Base{
private static class Derived extends Base{ }
private static class SuperDerived extends Base{ }
public static Base createDerived(){ return new Derived(); }
public static Base createSuperDerived(){ return new SuperDerived(); }
}
I do not want these derived classes to be used directly outside the body of the base class.
Is this a good way to do this? I am not sure about this, because these derivatives may consist of 100 lines of code, which will probably make it difficult to understand the base class.
source
share