Home Segments Index Top Previous Next

212: Mainline

The data-abstraction benefits of access functions—constructors, readers, and writers—disappear if you or an associate writes functions that include direct member-variable references or assignments.

If, for example, you decide to switch from radius-based descriptions to diameter-based descriptions, then C++ no longer can compile any expression that attempts to access the radius member variable directly. On the other hand, if you prevent direct access to the radius member variable, no one can accidentally come to rely on such expressions.