C++11 In-Class Initializers
C++11 allows you to provide a default value for a data member when you declare it in the class declaration. For example, lines 18–22 of Fig. 5.9 could have initialized data members
0 as follows:
unsigned int aCount = 0; // count of A gradesunsigned int bCount = 0; // count of B gradesunsigned int cCount = 0; // count of C gradesunsigned int dCount = 0; // count of D gradesunsigned int fCount = 0; // count of F grades
rather than initializing them in the class’s constructor (Fig. 5.10, lines 10–18). In later chapters, we’ll continue discussing ...