The problem is this: I have an abstract class that does some work in its constructor, and a set of child classes that implement the abstract class:
class AbstractClass {
AbstractClass(){ /* useful implementation */ }
}
class ConcreteClass1 extends AbstractClass {
ConcreteClass1(){ super(); /* useful implementation */ }
}
Then, the concrete classes need to be customized and one solution is to extend the concrete classes:
class CustomizedClass1 extends ConcreteClass1 {
CustomizedCLass1(){ super(); /* useful implementation */ }
}
BUT the problem is that the customized classes need only to call the abstract class's constructor and not the concrete class's constructor.
How do you achieve this? Suggestions to change the class's relationships are valid.
EDIT: The concrete example is that ConcreteClass1 and CustomizedClass1 have different sets of data (ConcreteData1 and CustomizedData1), and it is retrieved from the database in the class's constructor. The problem is that creating an instance of CustomizedClass1 will retrieve both data entities.
I am aware that using simple inheritance it's probably not the best thing to do, that's why I pointed out that suggestions to change the class's relationships are valid.