[bt-devel] Serious Bug
Eeli Kaikkonen
eekaikko at mail.student.oulu.fi
Thu Feb 11 10:39:21 MST 2010
On Thu, 11 Feb 2010, 'Kang Sun' wrote:
> Something from google c++ code guidelines...
>
> When redefining an inherited virtual function, explicitly declare it
> virtual in the declaration of the derived class. Rationale: If
> virtual is omitted, the reader has to check all ancestors of the
> class in question to determine if the function is virtual or not.
>
> Sure, there is a slight overhead of an extra pointer, but in a Qt
> environment, this isn't a big deal since there is so much Qt overhead
> already and these classes are big already.
There shouldn't be much extra overhead because the class has the v-table
if even one method is declared as virtual in the class OR in ancestor
class. The virtual method of an ancestor class is virtual in child
classes, too, even when it doesn't have the "virtual" declaration in
child classes. Adding it to the child classes is useful for the human
reader but does nothing else.
Yours,
Eeli Kaikkonen (Mr.), Oulu, Finland
e-mail: eekaikko at mailx.studentx.oulux.fix (with no x)
More information about the bt-devel
mailing list