Answers for "final in c++"

C++
1

final in c++

const int x = 8;
x = 10; // Error. x is final variable now
Posted by: Guest on December-08-2020
1

c++ final class

struct Base
{
    virtual void foo();
};
 
struct A : Base
{
    void foo() final; // Base::foo is overridden and A::foo is the final override
    void bar() final; // Error: bar cannot be final as it is non-virtual
};
 
struct B final : A // struct B is final
{
    void foo() override; // Error: foo cannot be overridden as it is final in A
};
 
struct C : B // Error: B is final
{
};
Posted by: Guest on December-04-2020

Browse Popular Code Answers by Language