forked from pezy/CppPrimer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a README.md file in ch18.
- Loading branch information
Showing
1 changed file
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
##Exercise 18.4 | ||
|
||
> What is the type of the exception object in the following throws? | ||
> | ||
> **(a)**`range_error r("error");` | ||
> `throw r`; | ||
> **(b)**`exception *p = &r;` | ||
> `throw *P;` | ||
>What would happen if the `throw` in **(b)** were written as `throw p`? | ||
The type of the exception object in (a) is range_error which is used to report range errors in internal computations. | ||
The type of the exception object in (b) is exception. | ||
If the "throw" in (b) were written as "throw p", there will be a runtime error. |