In this code:
#include <iostream>
#include <exception>
using namespace std;
class myexception : public exception
{
virtual const char* what() const throw() //<---**** Stared statement.
{
return "My exception happened";
}
};
What does the stared statement mean. What is the reason for using const keyword and the type char* ?
I am confused with both of the const keywords. I know the basic use of const like declaring a variable that will store a unchangeable value.....sort of like #define but when it is used with functions (such as in parameters) it is confusing. I am confused on the usage of char* instead of char in this line. Also what is the purpose of specifying const
before throw()
?