Applied Design Patterns with Java
Creational :: Singleton (127) {C ch 6}
Applicability
Use the Singleton pattern when:
- there must be exactly one instance of a class, and it
must be accessible to clients from a well-known access point;
- when the sole instance should be extensible by subclassing,
and clients should be able to use an extended instance without modifying their code.
Structure
Participants
Singleton -
- defines an Instance operation that lets clients access
its unique instance. Instance is a class operation, i.e.: a static (class method) in Java and a static member function in C++.
- may be responsible for creating its own unique instance.
Catalog Creational Prev Next