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

Quiz: Move Semantics and rvalue References · Question 6 of 10

After Buffer c = std::move(a);, what can you safely do with a?

After Buffer c = std::move(a);, what can you safely do with a?

  1. A.Read its old values, which are unchanged
  2. B.Destroy it or assign a new value to it
  3. C.Nothing; using a in any way is a compile error
  4. D.Only call delete on it
Answer & explanation

Correct answer: Destroy it or assign a new value to it

A moved-from object is valid but unspecified: it can be destroyed or reassigned, but its old value should not be relied on.

Can you get the rest right without peeking?

Take the timed Quiz: Move Semantics and rvalue References quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →