This is a question that I have had for a while, but never got around to understanding why and just followed suite. Hopefully you guys can answer my question.
In C++ when creating a singleton people traditionally mark the default constructor, copy constructor, and assignment operator as private to ensure only one object of the class can be created/retrieved through a static method.
I understand why the default constructor and copy constructor are marked as private, but what about the assignment operator?
Maybe I am missing something, but I can't think of a way to create an object just using the assignment operator.
I would like to say this isn't a question about the benefits and problems associated with Singletons in an application. I understand this.
In C++ when creating a singleton people traditionally mark the default constructor, copy constructor, and assignment operator as private to ensure only one object of the class can be created/retrieved through a static method.
I understand why the default constructor and copy constructor are marked as private, but what about the assignment operator?
Maybe I am missing something, but I can't think of a way to create an object just using the assignment operator.
I would like to say this isn't a question about the benefits and problems associated with Singletons in an application. I understand this.
Comment