C++ examples for Statement:throw
Constructors Throwing Exceptions
#include <iostream> #include <stdexcept> class C1 {/* ww w . j a v a2s . com*/ public: C1() { throw 99; } }; int main(int argc, const char *argv[]) { try { C1 c; } catch (int e) { std::cerr << "Exception: " << e << std::endl; } return 0; }