Need of privatizing assignment operator in a Singleton class

前端 未结 7 954
一生所求
一生所求 2021-01-18 04:01

Can someone justify the need of privatizing the assignment operator in a Singleton class implementation?

What problem does it solve by making Singleton& o

7条回答
  •  悲&欢浪女
    2021-01-18 04:33

    When you use a singleton the reason you implement it is because you only want one instance of an object of that class. In other words there is no need to make a copy of the instance because you can only have one instance. It is the same for the copy constructor.

提交回复
热议问题