public member function
<exception>
std::exception::whatvirtual const char* what() const throw();
virtual const char* what() const noexcept;
Get string identifying exception
Returns a null terminated character sequence that may be used to identify the exception.The particular representation pointed by the returned value is implementation-defined.
As a virtual function, derived classes may redefine this function so that specific values are returned.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// exception::what
#include <iostream> // std::cout
#include <exception> // std::exception
struct ooops : std::exception {
const char* what() const noexcept {return "Ooops!\n";}
};
int main () {
try {
throw ooops();
} catch (std::exception& ex) {
std::cout << ex.what();
}
return 0;
}
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4