Click here to Skip to main content
15,302,644 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i was reading about singleton classes and how they permit single instances, but i dont really understand the concept. I have some questions:

1. How do singletons differ from normal objects in c++?
2. When should you use them?
3. How are they helpful?
4. What are the advantages and disadvantages of them?

What I have tried:

i have tried numerous to search what it does, but i dont understand
Updated 11-Jul-21 2:56am

A singleton is no different than any other class, except that it only creates one object.

I wrote an article[^] about them which probably addresses your other questions.
CPallini 12-Jul-21 1:53am
CPallini 12-Jul-21 1:53am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900