C++ Logo


Advanced search

Subject: Re: [std-proposals] Specific Override Specifier
From: Ville Voutilainen (ville.voutilainen_at_[hidden])
Date: 2020-03-18 12:34:10

On Wed, 18 Mar 2020 at 19:16, Ryan Nicholl via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> A non-virtual function can override a virtual function, and vise versa. So virtual can't be deduced.

In either of those cases the functions you say are overriding are not
overriding. The point was that if you
have, hypothetically,

struct X : Y
    void Y::f() {...}

then we know that X::f is an override, so it doesn't need to be marked
as such, nor does it need to be marked
as virtual, because override, or its replacement syntax here, implies it.

Non-virtuals cannot override virtuals. That's hiding. Same goes for
virtuals 'overriding' non-virtuals, that's also hiding.

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

Standard Proposals Archives on Google Groups