Stuck? Need help? Ask questions on our forums.
*/

Other Views

corner
*/

CPLUSPLUS FAQ - Why Are Virtual Destructors Needed

Why do we need Virtual Destructors?

When classes are inherited, we need to make the base class destructor virtual – to make sure when the object is destroyed, all the derived class destructors also called. Otherwise the derived class destructors are not called because the there is compile time binding of the destructor pointer to the base class destructor.

C++ FAQ Home
corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.
Resource Listings