How can you stop the :
1.Creation of object : Make all constructors as private, this is the way singleton objects work.
If any one calls creates a static or dynamic object they will get the compilation error.
2.Creation of objects only on stack : Overload the new operator in your class and make it private.
3.Assignment of object to another object : Make you assignment operator as private.
4. Destruction of the object : Make your destructor as private and over load the delete operator and make it as private.
1.Creation of object : Make all constructors as private, this is the way singleton objects work.
If any one calls creates a static or dynamic object they will get the compilation error.
2.Creation of objects only on stack : Overload the new operator in your class and make it private.
3.Assignment of object to another object : Make you assignment operator as private.
4. Destruction of the object : Make your destructor as private and over load the delete operator and make it as private.
No comments:
Post a Comment