/* 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(...); ... }
My question is why there is a ‘const throw()’ after what()? Normally,if there is a throw() , it implies that the function before throw() can throw exception.However ,why there is a throw here?
Empty braces in
'throw()'means the function does not throw.