throw "Help!";can be caught by a handler of const char* type:
try { // ... } catch(const char* p) { // handle character string exceptions here }and
class Overflow { public: Overflow(char,double,double); }; void f(double x) { throw Overflow('+',x,3.45e107); }can be caught by a handler for exceptions of type Overflow:
try { f(1.2); } catch(Overflow& oo) { // handle exceptions of type Overflow here }
struct C { C() { } C(const C&) { if (std::uncaught_exceptions()) { throw 0; // throw during copy to handler's exception-declaration object ([except.handle]) } } }; int main() { try { throw C(); // calls std::terminate if construction of the handler's // exception-declaration object is not elided ([class.copy.elision]) } catch(C) { } }— end example