class myexception: public exception
{
virtual const char* what() const throw()
{
return "My exception happened";
}
};
Sorry, this question may sound dumb, but I have trouble parsing the header. Can someone describe in English what the header actually means? The first thing that seems odd to me is the keyword virtual
. The myexception
class is not a base class and inherits from the already implemented exception
class, so why use virtual
here? I guess const
is for the return type which is a c-style string that is const, and the other const
is to make sure nothing that the this object cannot be modified (can someone tell me what that object could be?). I have no idea what throw()
does exactly, never seen this syntax before.