C++ Logo

std-proposals

Advanced search

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

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 5 Jan 2023 21:56:30 +0000
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; }
};

However it's currently not permissible to mark a non-virtual member
function as 'final'.

Can we change this?

Received on 2023-01-05 21:56:42