EXPLORATION 45

image

Exceptions

You may have been dismayed by the lack of error checking and error handling in the Explorations so far. That’s about to change. C++, like most modern programming languages, supports exceptions as a way to jump out of the normal flow of control in response to an error or other exceptional condition. This Exploration introduces exceptions: how to throw them, how to catch them, when the language and library use them, and when and how you should use them.

Introducing Exceptions

Exploration 9 introduced vector’s at member function, which retrieves a vector element at a particular index. At the time, I wrote that most programs ...

Get Exploring C++ 11, Second Edition 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.