18.1.1. Throwing an Exception
In C++, an exception is raised by throwing an expression. The type of the thrown expression, together with the current call chain, determines which handler will deal with the exception. The selected handler is the one nearest in the call chain that matches the type of the thrown object. The type and contents of that object allow the throwing part of the program to inform the handling part about what went wrong.
throw is executed, the statement(s) following the
throw are not executed. Instead, control is transferred from the
throw to the matching
catch might be local to the same function or might be in a function that directly or indirectly called the function in which the exception occurred. The ...