-
What is the output of this program?
#include <iostream>
#include <exception>
using namespace std;
class NewExcep: public exception
{
virtual const char* what() const throw()
{
return "New exception occurred...";
}
} NewExcep;
int main ()
{
try
{
throw NewExcep;
}
catch (exception& excep)
{
cout << excep.what() << endl;
}
return 0;
}
-
- Exception
- Compilation Error
- New exception occurred...
- Runtime Error
- None of these
Correct Option: C
This is a type of exception arising in the class. We can call this
also as a standard exception.