CS202 5- ‹#›
Catching an Exception
n  try {
n    if (c != 'x')
n      throw c;  //throw exception of type char
n    if (i != 42)
n      throw i;  //throw exception of type int
n    cout <<"no throw was executed" <<endl;
n  }
n
n  catch(char) { //catch char exception
n    cout <<"char exception handler called" <<endl;
n  }
n
n  catch(...) {  //catch all other exceptions
n    cout <<"universal exception handler called" <<endl;
n  }
n