The access modifiers
private control access to a class’s variables, methods and properties. (In Chapter 11, we’ll introduce the additional access modifier
protected.) As we stated in Section 10.2, the primary purpose of
public methods is to present to the class’s clients a view of the services the class provides (that is, the class’s public interface). Clients of the class need not be concerned with how the class accomplishes its tasks. For this reason, a class’s
private variables, properties and methods (i.e., the class’s implementation details) are not directly accessible to the class’s clients.
Figure 10.3 demonstrates that
private class members are not directly accessible outside the class. Lines ...