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
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
Source code
- Singleton class Dossier
- Uses lazy instantiation
Examples
Resources URL:
notes/design_patterns/resources
Sources URL:
notes/design_patterns/sources
