Item-39 Use private inheritance judiciously
· โ˜• 6 min read

Private inheritance means is-implemented-in-terms-of. It is usually inferior to composition, but it makes sense when a derived class needs access to protected base members or needs to redefine inherited virtual functions. For library developers who strive to minimize object sizes, it also offers the ability of empty base optimization.


Item-35 Consider Alternatives to Virtual Functions
· โ˜• 7 min read

Alternatives to virtual functions include the NVI idiom (as an example of the Template Method design pattern) and various forms of the Strategy design pattern.