1struct Base
2{
3 virtual void foo();
4};
5
6struct A : Base
7{
8 void foo() final; // Base::foo is overridden and A::foo is the final override
9 void bar() final; // Error: bar cannot be final as it is non-virtual
10};
11
12struct B final : A // struct B is final
13{
14 void foo() override; // Error: foo cannot be overridden as it is final in A
15};
16
17struct C : B // Error: B is final
18{
19};