Singleton Pattern

Learn about the singleton pattern along with its structure, participants, and use cases.


Sometimes a class only needs to have one pointer. For example, a system should only have one printer spooler, even though there may be several printers. Similarly, we can have multiple users on a website, but we don’t create a new server for every user. The server remains a singleton.

Get hands-on with 1200+ tech skills courses.