17.10 Standard Library Exception Hierarchy
Exceptions fall nicely into a number of categories. The C++ Standard Library includes a hierarchy of exception classes, some of which are shown in Fig. 17.10. As we first discussed in Section 17.2, this hierarchy is headed by base-class exception
(defined in header <exception>
), which contains virtual
function what
that derived classes can override to issue an appropriate error message. If a catch
handler catches a reference to an exception of a base-class type, it also can catch
a reference to all objects of classes derived publicly from that base class—this allows for polymorphic processing of related errors.
Immediate derived classes ...
Get C++ How to Program, 10/e 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.