The final specifier in C++ marks a class or virtual member function as one which cannot be derived from or overriden. For example, consider the following code: struct base { virtual void f() const = 0; }; struct derived final : base { void f() const override {} };
They are relatively cheap, but I think cheap does not mean free and some references mention a performance hit that can be as high as 7%.
Yeah, because of this performance hit.
One of the cool things about this article is the fact that it points out how adding ‘final’ can magically get rid of that performance hit.