Testing Class GradeBook

The program of Fig. 7.17 creates an object of class GradeBook (Figs. 7.157.16) using the int array grades (declared and initialized in lines 11–12). The scope resolution operator (::) is used in the expression “GradeBook::students” (line 11) to access class GradeBook’s static constant students. We use this constant here to create an array that’s the same size as the array stored as a data member in class GradeBook. Line 13 declares a string representing the course name. Line 15 passes the course name and the array of grades to the GradeBook constructor. Line 16 displays a welcome message, and line 17 invokes the GradeBook object’s processGrades member function.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.