GradeBook.h: Defining a Class’s Interface with Function Prototypes
GradeBook.h (Fig. 3.11) contains another version of
GradeBook’s class definition (lines 8–17). This version is similar to the one in Fig. 3.9, but the function definitions in Fig. 3.9 are replaced here with function prototypes (lines 11–14) that describe the class’s public interface without revealing the class’s member-function implementations. A function prototype is a declaration of a function that tells the compiler the function’s name, its return type and the types of its parameters. Also, the header still specifies the class’s
private data member (line 16) as well. Again, the compiler must know the data members of the class to determine how much memory to reserve for ...