Generally, a singleton pattern is used to restrict the
number of instances of a class to only one object. This means there can be only
one instance of a class at any time. All the requests for an instance of the
class would point to the same object that was created earlier.
The singleton pattern is implemented by creating a class
with a method that creates a new instance of the object if one does not exist.
If an instance already exists, it simply returns a reference to that object. To
make sure that the object cannot be instantiated any other way, the constructor
is made either private or protected.