 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
try {
|
|
if (c != 'x')
|
|
throw c; //throw exception of type char
|
|
if (i != 42)
|
|
throw i; //throw exception of type int
|
|
cout <<"no throw was
executed" <<endl;
|
|
}
|
|
|
catch(char) { //catch char exception
|
|
cout <<"char exception
handler called" <<endl;
|
|
}
|
|
|
catch(...) { //catch all other exceptions
|
|
cout <<"universal exception
handler called" <<endl;
|
}
|
|