Summary
In this chapter, we have begun expanding our C++ programming repertoire beyond OOP language features to include features that will enable us to write more robust programs. User code can inevitably be error-prone by nature; using language supported exception handling can help us achieve less buggy and more reliable code.
We have seen how to utilize the core exception handling features with try
, throw
, and catch
. We’ve seen a variety of uses of these keywords – throwing exceptions to outer handlers, using an assortment of handlers featuring various types, and selectively grouping program elements together within a single try block, for example. We have seen how to register our own functions with set_terminate()
and set_unexpected()
. We have seen how to utilize the existing C++ Standard Library exception
hierarchy. We have additionally explored defining our own exception classes to extend this hierarchy.
We have added key features to our C++ skills by exploring...