相关疑难解决方法(0)

任何人都可以向我解释C++异常规范吗?

任何人都可以解释C++中使用的异常规范吗?

  • 它们何时使用(我很少看到它在代码中使用)
  • 使用异常规范有哪些优缺点(优点/缺点)?

c++

12
推荐指数
3
解决办法
4551
查看次数

C++中的Looser Throw Specifier

这个错误是什么意思?我该如何解决?这是导致它的标头代码:

class BadJumbleException : public exception {
public:
    BadJumbleException (const string& msg); // Constructor, accepts a string as the message
    string& what();                         // Returns the message string
private:
    string message;                         // Stores the exception message
};
Run Code Online (Sandbox Code Playgroud)

这是源代码:

BadJumbleException::BadJumbleException (const string& m) : message(m) {}
string& BadJumbleException::what() { return message; }
Run Code Online (Sandbox Code Playgroud)

编辑:这是错误:

'virtual BadJumbleException :: ~BadJumbleException()的松散抛出说明符

c++ c++11

11
推荐指数
1
解决办法
2万
查看次数

标签 统计

c++ ×2

c++11 ×1