If I create a struct:
struct joinpoint_exception: exception
{
virtual const char* what () const throw ();
};
What does what () const throw () means in this context?
what is a virtual member function returning a pointer to constant char which is itself constant and throws nothing.
virtual const char* what () const throw ();
|-----| <- virtual member function
|---------| <- returning a pointer to constant chars
|-----| <- named what
|---| <- which is constant
|-------| <- which does not throw
(Technically the function can still throw, but if it does, it goes directly to std::unexpected, which defaults to calling std::terminate)
what is name of the method
const means that the method does not alter any internal data unless its mutable
throw () means that the method should not throw an exception, if it does std::unexpected is thrown instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With