For those who desire some concrete examples illustrating the abstractions discussed in this text, I have provided 21 C++ programs. Those examples of general interest are published in this appendix. The remainder is available from Addison-Wesley at World Wide Web URL http://www.aw.com/cp/riel.html. and via anonymous FTP from ftp.aw.com in the directory cp/riel. The examples and a brief description of each are provided in the following list.
|
#1
| 2
| The implementation of the AlarmClock class described in Section 2.1.
|
#2
| 3
| The implementation of the course-scheduling system described in Section 3.3. The solution without controller classes is illustrated here.
|
#3
| 3
| The implementation of the home heating system described in Section 3.4 (poor design with accessor methods).
|
#4[*]
| 3
| The implementation of the home heating system described in Section 3.4 (good design without accessor methods).
|
#5[*]
| 4
| The implementation of the "car uses a gas station" example described in Section 4.3. The five methods for implementing the uses relationship are demonstrated.
|
#6
| 4
| The implementation of the meal containment hierarchy as described in Section 4.6.
|
#7
| 5
| The implementation of the fruit basket example described in Section 5.9.
|
#8
| 5
| The implementation of the meal containment hierarchy with inheritance as described in Section 4.6. This is a more general solution of Example #6.
|
#9[*]
| 5
| The implementation of the sorted linked list inheriting from the linked list example described in Section 5.10.
|
#10[*]
| 5
| The implementation of the LinkedRing class added to the linked list hierarchy of Example #9.
|
#11
| 5
| The first solution to the "core the apple in the fruit basket" problem discussed in Section 5.19. This solution uses a NOP method in the base class.
|
#12
| 5
| The second solution to the "core the apple in the fruit basket" problem discussed in Section 5.19. This solution uses a bookkeeping mechanism in the containing class.
|
#13
| 5
| The third solution to the "core the apple in the fruit basket" problem discussed in Section 5.19. This solution uses a generic message handler, which is overridden in each derived class.
|
#14
| 6
| The implementation of the wooden door example described in Section 6.3.
|
#15[*]
| 6
| The implementation of the graduate student example described in Section 6.7. It illustrates the use of virtual, multiple inheritance in C++.
|
#16
| 8
| The implementation of the Invoice class described in Section 8.3.
|
#17[*]
| 8
| The implementation of the weak type-checking solution for constructing linked lists of dogs, linked lists of meals, and linked lists of airplanes; as described in Section 8.4.
|
#18[*]
| 8
| The implementation of the template solution for constructing linked lists of dogs, linked lists of meals, and linked lists of airplanes; as described in Section 8.4.
|
#19[*]
| 9
| The implementation of a minimal public interface in C++ on a reference-counting String class. This minimal interface is described in Section 9.5.
|
#20[*]
| 9
| An example implementation of garbage collection in C++. The example examines a node class that hoards memory, and the memory handler that frees the space on demand.
|
#21[*]
| 11
| The implementation of the automatic teller machine/bank example as designed in Chapter 11.
|