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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.