exception Class

选件类作为标准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>定义的标准异常选件类的根。 what 返回的C字符串值由默认构造函数未指定,则,但可能是某些派生类的构造函数定义为一个实现中定义的C字符串。 成员函数都不会引发任何异常。

int 参数使您得以指定不应分配内存。 int 的值被忽略。

备注

构造函数 exception(const char * const &message) 和 exception(const char * const &message, int) 是Microsoft扩展到标准C++库。

示例

在从 exception 选件类继承的使用标准异常选件类的示例,请参见。<stdexcept>定义的任何选件类。

要求

标题: <exception>

命名空间: std

请参见

参考

线程安全性对标准C++库中