19.3.2 (cont.) Example - catch Clauses

void read()
{
   try
   {
      . . .
      double d = future_value();
   }
   catch (bad_alloc& e)
   {
      cout << "caught bad_alloc error " << e.what() << "\n";
   }
}

double future_value(...)
{
   . . .
   throw FutureValueError("illegal future_value parameter");
}

prev |top |next