与导出标准异常类相关的问题

Mai*_*nID 4 c++ exception

/* user-defined exception class derived from a standard class for exceptions*/

class MyProblem : public std::exception {

public:

    ...

    MyProblem(...) { //special constructor
    }

    virtual const char* what() const throw() {
    //what() function
    ...
    }

};

...

void f() {
...

//create an exception object and throw it

throw MyProblem(...);

...


}
Run Code Online (Sandbox Code Playgroud)

我的问题是为什么在()之后有一个"const throw()"?通常,如果有一个throw(),它意味着throw()之前的函数可以抛出异常.但是,为什么抛出这里?

Ale*_*x B 8

空括号"throw()"表示函数不抛出.