May 2002
Beginner
320 pages
6h 18m
English
Handling this new exception requires a new function in the ErrorHandlingModule's SAMSErrorHandling namespace.
This function, shown in Listing 11.3, is pretty simple.
1: int HandleRuntimeError(runtime_error theRuntimeError)
2: {
3: cerr <<
4: theRuntimeError.what() <<
5: endl;
6:
7: return 1;
8: }
|
Line 1 is the function header and shows the formal argument theRuntimeError, which is of type runtime_error. Line 4 uses the standard exception what() function to get the error message you put into the exception object in lines 14 and 15 of Accumulate(). Line ... |
Read now
Unlock full access