C++ 异常处理
内容目录
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;
}
上一篇
下一篇