Exception Handling In C++ Explained With Simple Example

Exception Handling in C++ allows a programmer to handle run time errors in an orderly fashion. Using this routine, an error handling function can be invoked which can take some corrective action to avoid system crash or to recover the system from errors.
Exception Handling in C++ is built using three keywords – try, catch and throw.
In general, all the code which might throw some error put into try block and expected errors are caught using catch block.
If an error occurred in try block then that error is thrown (error can be thrown explicitly by calling throw also) which will be caught by relevant catch block.

(more…)
Exception Handling In C++ Explained With Simple Example Read More