1.

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;
}

A. Compilation Error
B. Runtime Error
C. Exception Occurred...
D. Garbage value
E. None of these
Answer» D. Garbage value


Discussion

No Comment Found

Related MCQs