C++ examples for Statement:try catch
Order of Exception Handlers
#include <iostream> #include <stdexcept> int main(int argc, const char *argv[]) { try {/*from ww w . j av a 2 s .com*/ throw std::exception(); } catch (std::exception &e) { std::cout << "Executed as first: " << e.what() << std::endl; } /* uncomment to see error catch (std::exception &e) { std::cout << "Executed IF first" << e.what() << std::endl; }*/ return 0; }