#include #include using namespace std; class MyEventT { public: MyEventT(string w): msg{w}{ cout << "In the constructor with " << w << endl; } string what() const { return msg; } ~MyEventT() { cout << "In the destructor for " << msg << endl; } private: string msg; }; int main() { try { cout << "throw" << endl; throw MyEventT{"new one"}; } catch (const MyEventT & e) { cout << e.what()<< endl; cout << "hello" << endl; } cout << "After catch" << endl; throw MyEventT {"second one"}; cout << "Before return " << endl; return 0; }