-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQuestion_16.cpp
52 lines (52 loc) · 939 Bytes
/
Question_16.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include<iostream>
using namespace std;
class base
{
protected:
int a,b;
public:
void readB()
{
cout<<"Enter value of A and B:-"<<endl;
cin>>a>>b;
}
};
class derrived :public base
{
protected:
int c,d;
public:
void read_d()
{
cout<<"Enter value of C and D:-"<<endl;
cin>>c>>d;
}
};
class dChild
{
protected:
int e;
public:
void read_dC()
{
cout<<"Enter value of E:-"<<endl;
cin>>e;
}
};
class dC_child :public dChild,public derrived
{
public:
void fun()
{
readB();
read_d();
read_dC();
cout<<"Result is of a+b+c*d/e:-"<<a+b+c*d/e<<endl;
}
};
int main()
{
dC_child obj;
obj.fun();
return 0;
}