I know that the annotation of the final method in C ++ (since C ++ 11) is done in terms of language.
class Base { virtual void method(); }; class Locked : public Base { virtual void method() final; };
Any class derived from Locked can no longer override method .
But what does he say about the API, about the contract in terms of OOP? As Java has already said , what should I know as the author of the Locked class about the design of the entire class now , what do I promise?
For example: I could imagine that, annotating with final , I say that "this behavior of the methods does not change." But what if I call other methods inside method() ? If they can be redefined, how can I promise this? So, does the final value comment, should I not use other overridable methods inside this method, strictly speaking, from the point of view of OOP? Or other design limitations?
source share