I have an abstract class Entity . For each class that extends Entity , you will need some default setting and some custom setting:
public abstract class Entity { protected Entity() {
My extensible class MyEntity takes a parameter in the constructor, which will be used in customSetup() :
public class MyEntity extends Entity { private Data data; public MyEntity(Data d) { super();
As stated in the comments, this code will not work.
I could just throw away customSetup() and put all the user code after super() , but using this abstract method itβs clearer to choose what you have to put there.
I feel like Iβm breaking some rule of OOP design. What is the right way to do what I want?
java design oop
bigstones
source share