Chapter 18. Virtuality

Difficulty: 7

In this Item, we delve into old questions with new and/or improved answers. The up-to-date answers to two recurring questions about virtual functions lead directly to four guidelines targeting robust class design. These guidelines answer these questions: why should interfaces be nonvirtual? why should virtuals be private? and what's with the old and hoary advice about base class destructors, and is the old hoary advice really true?

Solution

In this Item, I want to present up-to-date answers to two recurring questions ...

Get Exceptional C++ Style 40 New Engineering Puzzles, Programming Problems, and Solutions now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.