I am taking a course online and came across some syntax I am not really sure I understand.
#include <iostream>
#include <exception>
using namespace std;
class derivedexception: public exception {
virtual const char* what() const throw() {
return "My derived exception";
}
} myderivedexception;
int main() {
try {
throw myderivedexception;
}
catch (exception& e) {
cout << e.what() << '\n';
}
}
My Problem is with:
virtual const char* what() const throw()
What does this line mean?
also, what is with the
} myderivedexception;
in the end of the class declaration?