classes

hi, i want to make sure that no more than one object of a class should be constructed please help me
Look up the singleton pattern.
The singleton pattern is controversial. Why is it so important to make sure there is only one object? Just create one object and there will be only one object.
Just create one object and there will be only one object.


When working on a project with more than one programmer and/or non-deterministic operations, it's possible to not know at what stages other pieces of code may or may not have created or be using some object of which there must be only one. The singleton is an efficient solution.
Last edited on
The singleton pattern is controversial
How ? and how do you create the singleton class and object .
user of your programm should not be abe to make more than one object?
Topic archived. No new replies allowed.