-
What is the output of this program?
#include <iostream>
#include <exception>
using namespace std;
class ExceptionExample: public exception
{
virtual const char* what() const throw()
{
return "Exception Occurred...";
}
} NewExcep;
int main ()
{
try
{
throw NewExcep;
}
catch (exception& excep)
{
cout << excep.what() << endl;
}
return 0;
}
-
- Compilation Error
- Runtime Error
- Exception Occurred...
- Garbage value
- None of these
Correct Option: C
In this program, We are arising a standard exception and catching that and returning a statement.