Question
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
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
Answer: Option A
Was this answer helpful ?
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