exception 类
该类用作标准 C++ 库中某些表达式抛出的所有异常的基类。
class exception {
public:
exception();
exception(const char * const &message);
exception(const char * const &message, int);
exception(const exception &right);
exception& operator=(const exception &right);
virtual ~exception();
virtual const char *what() const;
};
备注
具体而言,此基类为 <stdexcept>定义的标准异常类的根。 C# what 返回的字符串值由默认构造函数未指定,但能由特定派生类的构造函数定义为实现定义的 C 字符串。 成员函数不引发任何异常。
int 参数使您得以指定不应分配内存。 int 的值将忽略。
备注
构造函数 exception(const char * const &message) 和 exception(const char * const &message, int) 是 Microsoft 扩展的标准 C++ 库。
示例
有关从 exception 类继承来的标准异常类的示例,请参见 <stdexcept>定义的任何类。
要求
标头: <exception >
命名空间: std