What's the use of the private copy constructor in c++

后端 未结 7 1376
抹茶落季
抹茶落季 2020-11-29 23:44

Why do people define a private copy constructor?

When is making the copy constructor and the assignment operator private a good design?

If there are no membe

7条回答
  •  温柔的废话
    2020-11-30 00:35

    You might want to implement some of the methods of the class using a copy constructor, but not to expose it outside of the class. So then you make it private. Like any other method.

提交回复
热议问题