The Singleton Object-Oriented Pattern

Sometimes it’s important to have only one instance for a class. For example, in a system there should be only one window manager (or only a file system or only a print spooler). Usually singletons are used for centralized management of internal or external resources and they provide a global point of access to themselves. Continue reading

Advertisements
Image

Singleton Pattern illustration

Singleton Pattern illustration

The implementation involves a static member in the “Singleton” class, a private constructor and a static public method that returns a reference to the static member.