Skip to main content

Singleton

The Singleton design pattern ensures a class has only one instance and provide a global point of access to it.

Usage     Usage     Medium-high

UML class diagram

A visualization of the classes and objects participating in this pattern.

diagram

Sample code

This structural code demonstrates the Singleton pattern which assures only a single instance (the singleton) of the class can be created.

Output

See also