[Digikam-devel] Re: Logic error

Andi Clemens andi.clemens at gmx.net
Mon Nov 22 22:03:43 GMT 2010


Actually it doesn't hurt to declare all qobject based classes with a virtual 
destructor, in Qt source this is done for all derived classes, not only in the 
base class.
I will first add the virtual keyword to all the qobject based classes, if 
there are still warnings, I will take a look at all the other classes and add 
the keyword accordingly.

Andi Clemens
-----------------
www.digikam.org

On Monday 22 November 2010 19:26:43 Andi Clemens wrote:
> Ok, hope this is true for every compiler out there... :-)
> I will take a look at the code analysis later this evening.
> 
> Andi
> 
> -------- Original-Nachricht --------
> 
> > Datum: Mon, 22 Nov 2010 18:48:19 +0100
> > Von: Marcel Wiesweg <marcel.wiesweg at gmx.de>
> > An: "digiKam developers room - digiKam - Manage your photographs as a\\
> > 	professional with the power of open source" <digikam-devel at kde.org>
> > Betreff: [Digikam-devel] Re: Logic error
> > 
> > > But don't you have to declare it "virtual" again in all derived
> > > classes, although the base class already defined it like this?
> > 
> > Yes, a method is always virtual if declared in the base class, in the
> > derived
> > class the keyword is cosmetic. Same source as above:
> > 
> > "Note: in a derived class, if your base class has a virtual destructor,
> > your
> > own destructor is automatically virtual. You might need an explicit
> > destructor
> > for other reasons, but there's no need to redeclare a destructor simply
> > to make sure it is virtual. No matter whether you declare it with the
> > virtual keyword, declare it without the virtual keyword, or don't
> > declare it at all,
> > it's still virtual."
> > 
> > Marcel
> > _______________________________________________
> > Digikam-devel mailing list
> > Digikam-devel at kde.org
> > https://mail.kde.org/mailman/listinfo/digikam-devel



More information about the Digikam-devel mailing list