program exception
Exceptions provide a way to react to exceptional circumstances (like run-time errors) in our program by transferring control to special functions called handlers.
try {
//expection inspectation
/* code */
//if exception occured, throw..
throw T;
}
catch(T error) // argument type match the thrown var
{ /* code */ }
/*** catch can be chainning with different type of argument as following ***/
try {
// code here
}
catch (int param) { cout << "int exception"; }
catch (char param) { cout << "char exception"; }
catch (...) { cout << "default exception"; }
/*** It is also possible to nest try-catch blocks within more external try blocks. ***/
reference
http://www.tutorialspoint.com/cplusplus/cpp_exceptions_handling.htm
http://www.cplusplus.com/doc/tutorial/exceptions/
try {
//expection inspectation
/* code */
//if exception occured, throw..
throw T;
}
catch(T error) // argument type match the thrown var
{ /* code */ }
/*** catch can be chainning with different type of argument as following ***/
try {
// code here
}
catch (int param) { cout << "int exception"; }
catch (char param) { cout << "char exception"; }
catch (...) { cout << "default exception"; }
/*** It is also possible to nest try-catch blocks within more external try blocks. ***/
reference
http://www.tutorialspoint.com/cplusplus/cpp_exceptions_handling.htm
http://www.cplusplus.com/doc/tutorial/exceptions/
Comments
Post a Comment