#include <iostream> <!--more--> #include <exception> using namespace std; class MyClass { class Myexception : public logic_error { public: Myexception(const char *s) : logic_error(s) {} };
public: void ThrowExcept() throw(Myexception) { throw Myexception("my exception"); } };
int main() { try { MyClass mc; mc.ThrowExcept(); } catch (const std::exception &e) { std::cerr << e.what() << '\n'; } }
|