Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
class Test1
4.
{
5.
};
6.
class Test2 : public Test1 { };
7.
void Funct();
8.
int main()
9.
{
10.
try
11.
{
12.
Funct();
13.
}
14.
catch (const Test1&)
15.
{
16.
cerr
Options:
A .  Caught an exception
B .  NULL
C .  both a & b
D .  none of the mentioned
Answer: Option A

In this program, We are arising the exception by using the method in the class.
Output:
$ g++ uce3.cpp
$ a.out
Caught a exception



Was this answer helpful ?

Submit Solution

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

Latest Videos

Latest Test Papers