Singleton


Usage

  • A class of which only a single instance can exist
  • Ensure a class has only one instance and provide a global point of access to it
  • Make all constructors and destructors private

Diagram

Singleton

Participants

Singleton
  • Defines an Instance operation that lets clients access its unique instance. Instance is a class operation.
  • Responsible for creating and maintaining its own unique instance.

 

C++

Description
  • Singleton class Dossier
  • Uses lazy instantiation
Source code
Examples

Resources URL: 
notes/design_patterns/resources
Sources URL: 
notes/design_patterns/sources

See Also