3 ms·
What does "final" mean in C++? Is that new? Maybe you're confusing with java?
by repelsteeltje 3y ago
What does "final" mean in C++? Is that new? Maybe you're confusing with java?
- canucker2016 3y agoC++11 adds support for specifying "final" on derived virtual functions to prevent further overriding of the function by any derived classes of the current "final" class.
- 1letterunixname 3y agoYep. Imported more-or-less from Java OOP.
- sudosysgen 3y agohttps://en.cppreference.com/w/cpp/language/final https://en.cppreference.com/w/cpp/language/final Final in C++ indicates that the function/class can no longer be overridden in further child classes. This enables devirtualization as the compiler can then know the function pointer will not change, if it can infer the type at compile time.
- epcoa 3y ago> Is that new? No. In fact in a few short months post C++11 will have overtaken pre-C++11 as the majority of the 26 year history of standardized C++ (and similar to prior standards, compilers for the fortunate implemented much of the behavior prior to the official publication).
- MichaelMoser123 3y ago> post C++11 will have overtaken pre-C++11 as the majority of the 26 year history of standardized C++ that's because they switched to a different 'release cycle' for C++ standards, also now they have minor releases like C++14.