🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Copy Constructor and Deep Copy: all 10 questions

Quiz: Copy Constructor and Deep Copy · Question 10 of 10

What is the rule of zero?

What is the rule of zero?

  1. A.Never use constructors
  2. B.Initialise all members to zero
  3. C.Use members like vector, string and smart pointers that manage themselves, so you write no destructor or copy functions
  4. D.Always delete the copy constructor
Answer & explanation

Correct answer: Use members like vector, string and smart pointers that manage themselves, so you write no destructor or copy functions

Resource-managing members already copy and clean up correctly, so the compiler-generated versions are right.

Can you get the rest right without peeking?

Take the timed Quiz: Copy Constructor and Deep Copy quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →