← 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?
- A.Never use constructors
- B.Initialise all members to zero
- C.Use members like vector, string and smart pointers that manage themselves, so you write no destructor or copy functions
- 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 →