Singleton Pattern – Design Pattern That Creates a Single Object
Singleton pattern is a design pattern belonging to the creational group. Singleton ensures that only a single object of the class will be instantiated. Another important element of a Singleton is that an object is treated as a "global" variable, meaning that the object can be accessed from anywhere in the program. When a class is built on the Singleton pattern, it can only be instantiated once. Any other initialization requests will be directed to the only object being instantiated. In addition, the object of a Singleton class will not be instantiated until it is actually used. In this article,…