Problem with subclasses
Opened this issue · 0 comments
Rado-1 commented
A problem with this implementation of singleton for sub-classes is that it depends on order of instantiation objects - if you first instantiate parent class and then the sub-class they share the same singleton object of parent class. For instance, taking the example from your README:
new Parent() === new ChildSingleton()
returns true, which is the problem, because I would expect that new ChildSingleton() is a different object that new Parent().
But:
new ChildSingleton() === new Parent()
returns false as expected.