← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH 0/4] Use of "virtual" and "override" keywords

 

To Simon: Fair. It is indeed a little odd that C++ committee decides to put
one before but one after the signature. Only that you might want to write
it in the style guide; otherwise, both styles will appear in the future.

To Mark: I said {the use of both is redundant}, not {one of them is
redundant}. But if this scenario happens in code reviewing, I'd accept your
comment that the original statement isn't in its most exact form and I
should say "virtual is redundant when using virtual + override".


On Thu, Jul 14, 2016 at 4:17 PM, Mark Roszko <mark.roszko@xxxxxxxxx> wrote:

> >It is redundant (you cannot override a non-virtual function)
>
> a() and b() in struct c in the example are virtual in both parents.
>
>
> override is simply a check to tell the compiler you intend to override
> a() and b() from parent classes.
>
> If you put virtual blah() in struct C without override, you can be
> creating a new virtual function if the signature does not match and
> its completely valid.
>

References