Exception Handling
Just like Java, C++ has a try-catch-throw mechanism for handling exceptions.
cerr << “Found an exception” << endl;
The g++ compiler requires that any C++ code containing the try-catch-throw keywords be compiled using the -fhandle-exceptions switch
The try block: encapsulates any code that can throw an exception
The catch block: catches the exception thrown and deals with it or throws it again
We can also throw and catch basic types such as int, double, etc. in addition to first-class objects