...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <exception> #include <iostream> struct S : std::exception { const char *what() const noexcept override { return "My custom exception"; } }; void f() { try { throw S(); } catch (std::exception Ee) { std::cout << Ee.what() << std::endl; } } |
...
Code Block | ||||
---|---|---|---|---|
| ||||
#include <exception> #include <iostream> struct S : std::exception { const char *what() const noexcept override { return "My custom exception"; } }; void f() { try { throw S(); } catch (std::exception &Ee) { std::cout << Ee.what() << std::endl; } } |
...