I have two classes (D and E) that have some common methods, the only difference is that D instantiates a singleton (A) and E instantiates another singleton(B).
E inherits from D and since the methods exec the same code, I' d like to check in D if I should create A or B singleton for not rewriting in E the same code of every common method...
A and B have inheritance from C abstract class...
Any advices?
Thanks in advance...
//Check subtype
if ....
A field = A.getInstance().getMethod();
else...
B field = B.getInstance().getMethod();
field.set...