Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
#include
3.
using namespace std;
4.
class myexc: public exception
5.
{
6.
virtual const char* what() const throw()
7.
{
8.
return "My exception";
9.
}
10.
} myex;
11.
int main ()
12.
{
13.
try
14.
{
15.
throw myex;
16.
}
17.
catch (exception& e)
18.
{
19.
cout
Options:
A .  My
B .  My exception
C .  No exception
D .  None of the mentioned
Answer: Option B

This is a type of exception arising in the class. We can call this
also as a standard exception.
Output:
$ g++ std.cpp
$ a.out
My exception



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers