Home What is The Rule of Three?
Reply: 0

What is The Rule of Three?

user9999 Published in September 19, 2018, 6:44 pm
  • What does copying an object mean?
  • What are the copy constructor and the copy assignment operator?
  • When do I need to declare them myself?
  • How can I prevent my objects from being copied?
share|improve this question
  • 41
    Please read this whole thread and the c++-faq tag wiki before you vote to close. – sbi Nov 13 '10 at 14:06
  • 10
    @Binary: At least take the time to read the comment discussion before you cast a vote. The text used to be much simpler, but Fred was asked to expand on it. Also, while that's four questions grammatically, it really is just one question with several aspects to it. (If you disagree to that, then prove your POV by answering each of those questions on its own and let us vote on the results.) – sbi Nov 15 '10 at 23:02
  • Fred, here's an interesting addition to your answer regarding C++1x: stackoverflow.com/questions/4782757/…. How do we deal with this? – sbi Jan 25 '11 at 14:18
  • 5
    Related: The Law of The Big Two – Nemanja Trifunovic Jun 27 '11 at 16:39
  • 3
    Keep in mind that, as of C++11, I think this has been upgraded to the rule of five, or something like that. – paxdiablo Aug 19 '15 at 10:31

8 Answers 8

active oldest votes
up vote 1531 down vote accepted
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.432134 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO