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

后端 未结 7 1251
抹茶落季
抹茶落季 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.

    0 讨论(0)
提交回复
热议问题