From Jason Turner
Watch on YouTube

Summary

This episode explores C++'s 'final' keyword, which can be applied to classes to prevent inheritance or to virtual functions to prevent further overriding in derived classes. Jason explains how 'final' interacts with other specifiers like 'virtual' and 'override', recommending using only one of these three specifiers on a given function. He discusses the primary use case for 'final': marking 'inheritance leaves' where further derivation would be a logical error, and examines potential performance implications, noting that while past improvements were significant, modern compilers show more modest gains.

Resources

Tags