What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory or service locator either, owhat is it?You know that helper macro in MFC (pardon my ignorance but I haven't used MFC in probalby 6-7 years) that is used for creating object at runtime, used in Views, I think it's RUNTIME_CLASS or something???
I am implementing (in another language) a object which does:
1. Prevents direct instantiation by virtue of a private constructor
2. The second object which is used to create the said oibject manages the instances to limit only one per class
So I get the benefits of a singleton while still honoring inversion of control or DIP. Without the global introduced using a singleton.
My best research tells me it`s Multiton - which it is not due to the fact it the second object is instantiated and acts like a intelligent service locator, only creating the object if it`s not already created, caching it internally otherwise. You would need to pass this locator into dependents, there is no static to give access to named objects.
Cheers,
Alex