c 2b 2b final class

Solutions on MaxInterview for c 2b 2b final class by the best coders in the world

showing results for - "c 2b 2b final class"
Robin
27 Feb 2017
1const int x = 8;
2x = 10; // Error. x is final variable now
Olivia
22 Feb 2020
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};