main (lines 19–23) can create a
GradeBook object, we must tell the compiler what member functions and data members belong to the class. The
GradeBook class definition (lines 8–16) contains a member function called
displayMessage (lines 12–15) that displays a message on the screen (line 14). We need to make an object of class
GradeBook (line 21) and call its
displayMessage member function (line 22) to get line 14 to execute and display the welcome message. We’ll soon explain lines 21–22 in detail.
The class definition begins in line 8 with the keyword
class followed by the class name
GradeBook. By convention, the name of a user-defined class begins with a capital letter, and for readability, each subsequent word ...