GofPatterns GofPatterns


Singleton Pattern   «Prev 

Singleton Design Pattern Structure

Singleton design pattern consisting of 1) static Singleton theInstance 2) public static Singleton getInstance() 3) protected Singleton()



  1. This diagram shows that the Singleton pattern consists of a single class.
    This class takes the role of the Singleton in the operation.
    However, it need not be called Singleton. In general it will not be.
  2. This class has a single field called theInstance which points to the object that is the unique instance.
  3. The applicability of a pattern describes the circumstances under which the pattern is appropriate; that is, when you should and should not use it.
  4. The Singleton class has two methods, a static getInstance() method that returns a pointer or reference to the unique instance and a protected constructor.