created 12/13/98; revised: 09/23/99, 01/21/00, 07/14/02, 01/19/06, 11/11/08, 07/31/14, 08/21/17

go to home page   go to next page

CHAPTER 50 — Encapsulation

Good software design enforces encapsulation. This is where an object's instance variables are visible only to the object's own methods. Code outside of the object cannot directly access these variables. This chapter discusses the private visibility modifier to do this.

Recall that software objects have identity, state, and behavior. They should behave like objects in the real world. The state of an object changes because of its own behavior or because of well-defined interactions with other objects.

Chapter Topics:


Should a bank control who has access to your checking account?

go to home page   go to next page