内容目录
class myexception: public exception
{
virtual const char* what() const throw()
{
return "My exception happened";
}
};
int main ()
{
try
{
throw myexception();
}
catch (const exception& e)
{
cout << e.what() << '\n';
}
return 0;
}