Chapter 16. (Mostly) Private

Difficulty: 5

In C++, to what extent are the private parts of a class really truly private? In this Item, we see how private names are definitely not accessible from outside nonfriend code, and yet they do leak out of a class in small ways—some of which are well known, others of which aren't, and one of which can even be done as a coldly calculated, deliberate act.

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.