Reading that you can have final virtual functions in C++0x I am bit confused. What is the difference to just omitting both modifiers in the first place?
The difference occurs it's not the base that uses it, but the derived.
class Base {
virtual void foo() = 0;
};
class Derived : Base {
void foo() {}
// Still virtual because it's virtual in base- no way to "un-virtual" it
virtual void foo() final {}
// Now un-overridable.
};
Think of it not as preventing overrides, but preventing "any more" overrides.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With