kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #25465
Re: [PATCH 0/4] Use of "virtual" and "override" keywords
-
To:
KiCad Developers <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Simon Richter <Simon.Richter@xxxxxxxxxx>
-
Date:
Fri, 15 Jul 2016 11:38:54 +0200
-
In-reply-to:
<CAJjB1qLc=V3G2s4O6DdmKjS1oGRKy=mQPFe1MbopivpE+hyL4w@mail.gmail.com>
-
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.1.0
Hi,
On 14.07.2016 16:17, Mark Roszko wrote:
> 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.
Right, but that is something we can catch with "override".
The reason I like to have them there, besides having it immediately
visible, is the case
struct A {
virtual void foo();
};
struct B : A {
void foo();
};
struct C : B {
void foo();
};
{
B *b = new C;
b->foo();
}
This calls C::foo(), until the signature of A::foo() changes, then it
starts calling B::foo().
Simon
Attachment:
signature.asc
Description: OpenPGP digital signature
References