Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
class polygon
4.
{
5.
protected:
6.
int width, height;
7.
public:
8.
void set_values (int a, int b)
9.
{
10.
width = a; height = b;}
11.
};
12.
class output1
13.
{
14.
public:
15.
void output (int i);
16.
};
17.
void output1::output (int i)
18.
{
19.
cout
Options:
A .  DerivedOne
B .  DerivedTwo
C .  Error
D .  None of the mentioned
Answer: Option C

Answer:c
Explanation:
We are using the multiple inheritance to find the area of rectangle and triangle.
Output:
$ g++ mul.cpp
$ a.out
20
10



Was this answer helpful ?
Next Question

Submit Solution

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

More Questions on This Topic :

Latest Videos

Latest Test Papers