C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Derived class's function invokes base class's function

From: Bo Persson <bo_at_[hidden]>
Date: Wed, 6 Apr 2022 21:21:23 +0200
On 2022-04-06 at 17:34, Frederick Virchanza Gotham via Std-Proposals wrote:

>
> If the Derived class has more than one base class (including virtual
> inheritance), then the method called "Method" is invoked for every
> base class that has such a method -- this is where the 'continue'
> keyword will be a lot more useful, for example if we had:
>
> class Derived : public Base1, public Base2, public Base3,
> public base4 { . . . };
>
> then using the 'continue' keyword would generate the following code:
>
> this->Base1::Method():
> this->Base2::Method():
> this->Base3::Method():
> this->Base4::Method():
>
> What I am proposing here would work for any kind of method
> (irrespective of whether it's virtual or not). That is to say, the
> keyword 'continue' can be used alongside 'virtual' and 'override'.

What are the odds that I *always* need to call all base class methods?
And in that order?

Perhaps I only need to call three of them?

Received on 2022-04-06 19:21:31