jeudi 28 septembre 2017

What are the purposes of other members of a Singleton class besides the instance and its get method?

From Design Pattern by GoF

enter image description here

Participants

Singleton

  • defines an Instance operation that lets clients access its unique instance uniqueinstance. Instance is a class operation (that is, a class method in Smalltalk and a static member function in C++).

  • may be responsible for creating its own unique instance uniqueinstance.

Collaborations

• Clients access a Singleton instance uniqueinstance solely through Singleton's Instance operation.

In Class Singleton, uniqueinstance is the unique instance, and Instance() is its get method.

What are the purposes of the other members:

  • method SingletonOperation(),
  • method GetSingletonData(), and
  • field singletonData?

Thanks.

Aucun commentaire:

Enregistrer un commentaire