 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
This
change requires that the client program catch and
|
|
|
handle
the error and determine how to handle it.
|
|
| • |
The
class no longer performs error processing.
|
|
| • |
This
approach gives the client program control of how
|
|
|
errors
are handled and the type of error messages
|
|
|
provided.
|
|
| • |
To
detect when new fails, we use the regular form of new.
|
|
|
If
new cannot allocate the necessary space, it
|
|
|
automatically
throws an exception of type bad_alloc. If
|
|
|
the
index is out of bounds, we throw an exception instead
|
|
|
of
returning.
|
|
| • |
Therefore,
we do not need a dummy integer to return. But,
|
|
we do
need to define a type for the exception that is
|
|
|
thrown
(bad_index structure).
|
|