This appendix documents the foundation classes we use in the C++ sample code of several design patterns. We’ve intentionally kept the classes simple and minimal. We describe the following classes:
List, an ordered list of objects.
Iterator, the interface for accessing an aggregate’s objects in a sequence.
ListIterator, an iterator for traversing a
Point, a two-dimensional point.
Rect, an axis-aligned rectangle.
Some newer C++ standard types may not be available on all compilers. In particular, if your compiler doesn’t define
bool, then define it manually as
typedef int bool; const int true = 1; const int false = 0;
List class template provides a basic container for storing an ordered list of objects.