Figure 3.13 performs the same GradeBook
object manipulations as Fig. 3.10. Separating GradeBook
’s interface from the implementation of its member functions does not affect the way that this client code uses the class. It affects only how the program is compiled and linked, which we discuss in detail shortly.
As in Fig. 3.10, line 5 of Fig. 3.13 includes the GradeBook.h
header so that the compiler can ensure that GradeBook
objects are created and manipulated correctly in the client code. Before executing this program, the source-code files in Fig. 3.12 and Fig. 3.13 must both be compiled, then linked together—that is, the member-function calls in the client code need to be tied to the implementations of the class’s member functions—a job performed by the linker.