Is there any sense in marking a base class function as both virtual and final?
Yes, at least temporarily.
I found myself in a relatively large and unfamiliar existing C++ source code base. Much of the code was written prior to C++11. I found that I wanted to ensure that all overrides of a virtual function in a base class were marked with override
. The hard part is locating all of those overrides.
I marked the virtual function in the base class with final
, and the compiler quickly showed me where every single override was declared. It was then very easy to decorate the overrides how I wanted, and remove the final
from the virtual in the base class.