Below is my current design. All classes are singleton.( only one instance will be created at starting) set function should be override.
getinstance will return object of current class i.e.
Type getinstance() returns new Type().
Type2 getinstance() return new Type2().
Type
(set(), getinstance())
----------------------
| |
Type1 Type2
(set(), getinstance()) (set(), getinstance())
-----------------------
|
Type3
(set(), getinstance())
I have following questions:
getinstance()returns current object so it should not be inherited to child class but should be accessible to main function. How to achieve it? as I cannot make it as private class neither public and protected.do we have better design as we already know that all classes are singleton?
Aucun commentaire:
Enregistrer un commentaire