← Back to team overview

kicad-developers team mailing list archive

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

 

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