I was reading comments on Herb Sutter's Guru of the Week redux about virtual
functions, and finally saw him mentioning this:
[...] “uses of final are rarer” – well, they sort of are. I don’t know of many, and during standardization Bjarne repeatedly asked for examples of problems it solved and patterns where it should be used, and I don’t recall any major ones that stood out. The only one I know of offhand is that if you’re defining a library module (which isn’t a Standard concept yet) then making leaf classes final can give the compiler more information to devirtualize calls because of knowing code outside the library won’t further derive, but I’m not sure how important that is these days in the presence of whole program optimization including aggressive devirtualization.
That answer does not provide many examples about the use cases for final
on classes, and I would be interested in knowing what problems it can really solve. Do you know any, or will final
on classes only become some obscure and almost unused feature?