dev builds
themes manual
device status forums
mailing lists
IRC bugs
dev guide

Rockbox mail archive

Subject: Re: Destructors in Theme Editor: virtual or non virtual?

Re: Destructors in Theme Editor: virtual or non virtual?

From: Magnus Holmgren <>
Date: Thu, 17 Jun 2010 20:51:17 +0200

On 2010-06-17 20:11, Robert Bieber wrote:

> You are correct, I should be making them virtual (I'll go and fix that
> shortly). Strictly speaking, it isn't an issue unless you declare
> children of a class that has a non-virtual destructor. The compiler will
> always ensure that all parent-class destructors are called in order at
> destruction, but if you inherit from a class that has a non-virtual
> destructor, and then you delete a pointer to the base class which is
> also an instance of the child class, the child class' constructor won't
> be called. Now that someone else has mentioned it, I do think that
> having the original base class constructor virtual makes all the
> following destructors virtual, but it's still safest to just explicitly
> declare them all that way.

According to the C++ FAQ Lite, the destructor is automatically virtual
if the base class destructor is. See here for details:

Received on 2010-06-17

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy