// using standard exceptions #include #include using namespace std; class myexception: public exception { virtual const char* what() const throw() { return "My exception happened"; } } ; int main () { try { myexception myex ; throw myex; } catch (exception& e) { cout << e.what() << '\n'; } return 0; }