C++ Logo

STD-PROPOSALS

Advanced search

Subject: Re: [std-proposals] Specific Override Specifier
From: Tony V E (tvaneerd_at_[hidden])
Date: 2020-03-18 10:34:46


On Wed, Mar 18, 2020 at 11:18 AM Ville Voutilainen via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On Wed, 18 Mar 2020 at 16:38, Michał Policht via Std-Proposals
> <std-proposals_at_[hidden]> wrote:
> >
> > >
> > > I'd suggest a different syntax:
> > >
> > > class A : public B, public C
> > > {
> > > virtual int B::lock() override;
> > > virtual int C::lock() override;
> > > };
> > >
> > > but I've only needed this rarely; I suspect it probably isn't worth the
> > > trouble.
> >
> > With such syntax you could get rid of `override`, since it can be
> > deduced (maybe even `virtual`, but some language rules might prevent
> this).
>
> The complications begin to reveal themselves when we consider whether
> this facility needs to name
> an immediate base or not. Going further up the hierarchy, it might
> then need to name full paths to
> avoid ambiguities. The work-around I wrote doesn't suffer from that
> problem.
>

Yep, there would also be problems when trying to call the override.

void A::foo()
{
     B::lock(); // call base or call A's version of B::lock()
     A::B::lock();//??
}

-- 
Be seeing you,
Tony


STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups