Chapter 9. Adjusting Visibility
The ideals of object-oriented encapsulation generally steer us toward limiting the visibility of methods and attributes to the greatest extent possible and still satisfying the functional needs of the software. In general, this guidance is good. It lets us essentially virtualize our data elements so that all manipulation of those elements meets uniform expectations. Our most public methods represent the intrinsic behaviors that the outside world associates with the object being modeled. All other methods have lesser visibility motivated by their design purpose. Some methods are only visible to other classes—such as derived classes—of the same type. Different languages have additional variations in access levels. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access