You need a ‘throw’ clause to throw an exception.
Maybe you’ll get what you want if you change ‘launchException’ to:
void launchException() override
{
std::cout << customInt << std::endl;
std::cout << customStr << std::endl;
throw CustomException(customInt, customStr);
}
Also note the ‘override’ keyword. It may help avoiding the warnings you mentioned in the comments.
7
solved First time working with exceptions. I’m having difficulty understanding exceptions [closed]