-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path8_3.cpp
64 lines (64 loc) · 1.03 KB
/
8_3.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
53
54
55
56
57
58
59
60
61
62
63
64
#include<iostream>
using namespace std;
//create first class//
class alpha
{
private:
int x;
public:
//create parameterized constructor//
alpha(int k)
{
x=k;
}
void display()
{
cout<<"value of x is:"<<x<<endl;
}
};
//create second class//
class beta
{
private:
float y;
public:
//create parameterized constructor//
beta(float k)
{
y=k;
}
void display()
{
cout<<"value of y is:"<<y<<endl;
}
};
//create third class and inherit first and second class//
class Gamma:public alpha,public beta
{
private:
int m;
float n;
public:
//create parameterized constructor//
Gamma(int c,float d,int a,float b):alpha(a),beta(b)
{
m=c;
n=d;
}
void print()
{
cout<<"value of m is:"<<m<<endl;
cout<<"value of n is:"<<n<<endl;
}
};
int main()
{
//create object and pass values in parameter//
Gamma g(12,4.5,14,6.7);
g.print();
g.alpha::display();
g.beta::display();
cout<<endl;
cout<<"This program is performed by 22CS051_DARSH"<<endl;
return 0;
}