Professional Documents
Culture Documents
Exception Handling
Exception Handling
Runtime time error are called Exceptions and almost all OOP’s provide adequate methods to handle
these Exceptions.
So, the main function of exception handling is to give the user proper message so that he can
remove the error correctly.
In C++ throw statement is always required to throw the exception to the catch block.
When a throw statement is countered the execution of try stops and the control shifts to the catch
statement.
throw has to written in conditional statement such that for a particular input it gives error otherwise
it will be executed every time.
Try, Catch, Throw are mainly used so that two functions can communicate like if there is a exception
in a secondary function then it should tell the main function about it.