If the super-class has to know about its sub-classes before they exist, then you're choosing circular dependencies, which in my view, unless you really know what you're doing, is almost always bad design. In order to fix a problem anywhere, you have to fix every problem everywhere, or nothing in the dependency-chain will function.
This also alludes to the problem of calling interface functions directly in the constructor, which is A Bad Thing, because once that function is overridden, the super-version will never be called again.
Although I have no idea what you're actually trying to achieve here, this might be a better design for you:
class MyClass {
public MyClass() {
do_thingsMC();
}
public void do_things() {
do_thingsMC();
}
protected void do_thingsMC() {
//Do super-things only
}
}
class MyOther extends MyClass {
public MyOther() {
super();
do_thingsMO();
}
public void do_things() {
super.do_things();
do_thingsMO();
}
protected void do_thingsMO() {
//Do sub-things only
}
}
Now the super-things can always be done when needed (by calling do_thingsMC()
), as can sub-things (with do_thingsMO()
), and publically, users of your code can be assured of being able to do everything (with do_things()
).