Pergunta de entrevista da empresa Amazon Lab126

What is a virtual destructor and why would you use it?

Resposta da entrevista

Sigiloso

9 de jun. de 2014

A virtual destructor is when the base class destructor has no definition and can be overridden by the derived class. When an object is deleted, the base class destructor does not call the derived class destructor. Declaring the base class destructor as virtual resolves this issue.