Question
1.
#include
2.
using namespace std;
3.
class student
4.
{
5.
public:
6.
int rno , m1 , m2 ;
7.
protected:
8.
void get()
9.
{
10.
rno = 15, m1 = 10, m2 = 10;
11.
}
12.
};
13.
class sports
14.
{
15.
public:
16.
int sm;
17.
void getsm()
18.
{
19.
sm = 10;
20.
}
21.
};
22.
class statement : public student, public sports
23.
{
24.
int tot, avg;
25.
public:
26.
void display()
27.
{
28.
tot = (m1 + m2 + sm);
29.
avg = tot / 3;
30.
cout
What is the output of this program?
1.
#include
2.
using namespace std;
3.
class student
4.
{
5.
public:
6.
int rno , m1 , m2 ;
7.
protected:
8.
void get()
9.
{
10.
rno = 15, m1 = 10, m2 = 10;
11.
}
12.
};
13.
class sports
14.
{
15.
public:
16.
int sm;
17.
void getsm()
18.
{
19.
sm = 10;
20.
}
21.
};
22.
class statement : public student, public sports
23.
{
24.
int tot, avg;
25.
public:
26.
void display()
27.
{
28.
tot = (m1 + m2 + sm);
29.
avg = tot / 3;
30.
cout
Answer: Option A
Was this answer helpful ?
None.
Was this answer helpful ?
Submit Solution