nvoid a_function()
throw(char, int) { //exception spec
n int i;
n char c;
n cout <<"Enter a character and an
integer: ";
n cin >>c >>i;
n
n if (c != 'x')
n throw c;
//throw char exception
n if (i != 42)
n throw i;
//throw int exception
n
n cout <<"no throw was
executed" <<endl;
n}
nIf a function throws an exception that is not in the exception specification list, a call to a run time
library function
called unexpected is made. The default behavior for unexpected is to call terminate.
n