I am reading an awesome awesome C++11 tutorial and the author provides this example while explaining the final
keyword:
struct B {
virtual void f() const final; // do not override
virtual void g();
};
struct D : B {
void f() const; // error: D::f attempts to override final B::f
void g(); // OK
};
So does it make sense using here the final
keyword? In my opinion you can just avoid using the virtual
keyword here and prevent f()
from being overridden.