[Digikam-devel] Re: Logic error
Marcel Wiesweg
marcel.wiesweg at gmx.de
Mon Nov 22 17:48:19 GMT 2010
> 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
More information about the Digikam-devel
mailing list