C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Allow non-virtual methods to be final

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Fri, 6 Jan 2023 00:18:35 +0200
On Fri, 6 Jan 2023 at 00:18, Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:
>
> On Thu, 5 Jan 2023 at 23:56, Frederick Virchanza Gotham via
> Std-Proposals <std-proposals_at_[hidden]> wrote:
> >
> > The following should be allowed:
> >
> > struct A {
> > int Func(void) final { return 5; }
> > };
> >
> > in order to prevent the following from compiling:
> >
> > struct B : A {
> > int Func(void) { return 6; }
> > };
>
> Well, if you absolutely want to do that, you're not marking A::Func
> final because _________ ?

I mean mark it virtual and final.

Received on 2023-01-05 22:18:48