Software Engineering with Set and Get Functions
private data members can be manipulated only by member functions of that class (and by “friends” of the class as you’ll see in Chapter 9). So a client of an object—that is, any statement that calls the object’s member functions from outside the object—calls the class’s
public member functions to request the class’s services for particular objects of the class. This is why the statements in function
main call member functions
displayMessage on a
GradeBook object. Classes often provide
public member functions to allow clients of the class to set (i.e., assign values to) or get (i.e., obtain the values of)
private data members. These member function names ...