Appendix C. Foundation Classes

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 List.

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

image

C.1 List

The List class template provides ...

Get Design Patterns: Elements of Reusable Object-Oriented Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.