Bridge (4.3.1)
Design and execute a simple driver for the Bridge pattern classes
provided in the CD accompanying the textbook. Two classes need a
trivial modification to compile (set an arbitrary value for a
variable). The driver should create three sensors: a
StreamingSensor, a SimpleSensor, and an AveragingSensor.
Periodically, it should get a measurement from each sensor and
store it in a structure. After a fixed number of measures have been
taken, the structure should processed, e.g., printed.
Bridge (4.3.1)
A use of the Bridge pattern is to dynamically change the
implementation of an object. Design, code and test a stack with
the following characteristics. Initially, a stack is implemented
by an array and, consequently, has a fixed size. If there is a
need to push an element on a full fixed-size stack, the
implementation of stack is replaced by a linked list and, consequently,
the stack becomes unbounded.