Các ứng dụng có thể thêm các khóa học, nhưng nó không thể thay đổi điểm trung bình. Nếu ứng dụng có một nhu cầu chính đáng để thiết lập các điểm trung bình trực tiếp, các lớp học có thể cung cấp một chức năng thành viên cho mục đích đó, như sau: | 292 Part IV Inheritance__ The programmer can divide a single program into separate files known as modules. These individual source files are compiled separately and then combined during the build process to generate a single program. Modules can then be allocated to separate groups known as namespaces. The process of combining separately compiled modules into a single executable is called linking. There are a number of reasons to divide programs into more manageable pieces. First dividing a program into modules results in a higher level of encapsulation. Classes wall off their internal members in order to provide a certain degree of safety. Programs can wall off functions to do the same thing. Encapsulation is one of the advantages of object-oriented programming. Second it is easier to comprehend and therefore easier to write and debug a program that consists of a number of well-thought-out modules than a single source file full of all of the classes and functions that the program uses. Next comes reuse. I used the reuse argument to help sell object-based programming. It is extremely difficult to keep track of a single class reused among multiple programs when a separate copy of the class is kept in each program. It is much better if a single class module is automatically shared among programs. Finally there is the argument of time. A compiler such as Visual C or Dev-C doesn t need very long to build the examples contained in this book using a high-speed computer like yours. Commercial programs sometimes consist of millions of source lines of code. Rebuilding a program of that size can take more than 24 hours. A programmer would not tolerate rebuilding a program like that for every single change. However the majority of the time is spent compiling source files that haven t changed. It is much faster to recompile just those modules that have changed and then quickly link all modules together. Separate .