Sometimes it’s important for classes to
have exactly one instance.
For example: Although there can be many
printers in a system, there should be only one printer spooler. There should be
only one file system and one window manager.

Singleton
pattern ensures a class only has one instance, and provides a global point of
access to it.
To
implement singleton we need do following two things.
1.
Ensure a
class only has one instance:
This can be achieved by making constructor of a class private ( or protected: In case you want to extend this class.).
This can be achieved by making constructor of a class private ( or protected: In case you want to extend this class.).
2.
Provides a
global point of access to instance:
This can be achieved by keeping static
reference to unique instance and having method to get that instance.