Catch double exception : Exception type « Exceptions « C++ Tutorial






#include <iostream>
using namespace std;
int main(void)
{
   try {
      cout << "Inside try block." << endl;
      throw 100;
      cout << "This will not execute.";
   }catch(double d) {
      cout << "Caught a double exception -- value is: ";
      cout << d << endl;
   }
}








6.4.Exception type
6.4.1.Different types of exceptions can be caught
6.4.2.how to restrict the types of exceptions that can be thrown from a function.
6.4.3.Catch double exception
6.4.4.Catching class type exceptions
6.4.5.Catching Class Types