C++20 sections · 1024 units
Open in Course

Quiz: Virtual Destructors

Knowledge check

Check Your Understanding

What happens if you delete a derived object through a base pointer when the base destructor is NOT virtual?

  1. A.Both destructors run correctly
  2. B.Compilation error - cannot delete through base pointer
  3. C.Only the base destructor runs, potentially leaking resources
  4. D.Only the derived destructor runs
Start the roadmap to answer the quizzes and solve the challenges