(C++) final

February 24, 2017 · View on GitHub

 

 

 

 

 

(C++) C++11 final

 

final is a C++11 contextual keyword to indicate that a virtual member function cannot be overriden, or that a class cannot be used as a base class.

 

 

 

 

 

Examples

 

 

 

 

 

 

Advice

 

  • Use final only sparingly [1]

 

 

 

 

 

References

 

  1. Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 20.7. Advice. page 611: '[5] Use final only sparingly'