hey , i am trying to inherit the exception class and make a new class called NonExistingException: i wrote the following code in my h file:
class NonExistingException : public exception
{
public:
virtual const char* what() const throw() {return "Exception: could not find
Item";}
};
in my code before i am sending something to a function i am writing
try{
func(); // func is a function inside another class
}
catch(NonExistingException& e)
{
cout<<e.what()<<endl;
}
catch (exception& e)
{
cout<<e.what()<<endl;
}
inside func i am throwing an exception but nothing catches it. thanks in advance for your help.