What is Singleton pattern?- Singleton pattern is one of the design patterns that is utilized for restricting instantiation of a class to one or few specific objects.
- This facility is particularly useful when the system requires to coordinate the actions with exactly one object.
- It is a design pattern which restricts the instantiation of a class to one object.
- This pattern is implemented by creating a class with a method which creates a new instance of the class if one does not exist.
- It is one of the simplest design patterns.
- It provides a global point of access to the object.
- It defines a getInstance() method which exposes the unique instance, which is accessed by the clients.
|