August 2012
Intermediate to advanced
976 pages
30h 17m
English
try Blocks and ConstructorsIn general, exceptions can occur at any point in the program’s execution. In particular, an exception might occur while processing a constructor initializer. Constructor initializers execute before the constructor body is entered. A catch inside the constructor body can’t handle an exception thrown by a constructor initializer because a try block inside the constructor body would not yet be in effect when the exception is thrown.
Exercises Section 18.1.2
Exercise 18.4: Looking ahead to the inheritance hierarchy in Figure 18.1 (p. 783), explain what’s wrong with the following try block. Correct it.
try { // use of the C++ standard library} catch(exception) { // ...} catch(const runtime_error ...
Read now
Unlock full access