what Member Function of the Exception Parameter

When lines 82–85 catch the exception, the program displays a message indicating the problem that occurred. Line 84 calls the exception object’s what member function to get the error message that is stored in the exception object and display it. Once the message is displayed in this example, the exception is considered handled and the program continues with the next statement after the catch block’s closing brace. In this example, lines 88–92 execute next. We use exception handling again in Chapters 912 and Chapter 17 presents a deeper look at exception handling.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.