Answers 239
if (count != 0) {
throw (problem("Stack not empty"));
}
}
The destructor throws an exception. C++ does not like it when you throw
an exception in an exception. When that happens the program calls the
terminate()
function.
If you want to catch the second exception and other similar exception
problems, use the standard function
set_terminate
to establish a function to
take care of unexpected problems.
Avoidance 18: Don’t throw exceptions in destructors.
Answer 56: The problem is that the redefined
new function is implemented
incorrectly. The programmer assumed that when a person does a
new fast_bit_array
the size of the allocated object is
sizeof(fast_bit_array)
. This is not true when
fast_bit_array
is used as a base class. In this case, ...