← Quiz: C++ Interview Questions: all 10 questions
Quiz: C++ Interview Questions · Question 3 of 10
What problem does a shallow copy of a class with a raw pointer cause?
What problem does a shallow copy of a class with a raw pointer cause?
- A.Faster code
- B.Two objects share one buffer, leading to double free or unexpected changes
- C.Compile errors only
- D.Nothing
Answer & explanation
Correct answer: Two objects share one buffer, leading to double free or unexpected changes
Both destructors try to free the same memory.
Can you get the rest right without peeking?
Take the timed Quiz: C++ Interview Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →