-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut41.cpp
57 lines (52 loc) · 981 Bytes
/
tut41.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
#include<iostream>
using namespace std;
class mai
{
protected:
int mai;
public:
void set_mai(int a){
mai = a;
}
};
class tum
{
protected:
int tum;
public:
void set_tum(int b){
tum = b;
}
};
class pagal : public mai,public tum
{
public:
void show(){
cout<<"The value of mai is :"<<mai<<endl;
cout<<"The value of tum is :"<<tum<<endl;
cout<<"The value of mai or tum is :"<<mai+tum<<endl;
}
};
int main()
{
pagal ritik;
ritik.set_mai(40);
ritik.set_tum(60);
ritik.show();
return 0;
}
// Syntax for inheriting in multiple inheritance
// class DerivedC: visibility-mode base1, visibility-mode base2
// {
// Class body of class "DerivedC"
// };
/*
The inherited derived class will look something like this:
Data members:
mai --> protected
tum --> protected
Member functions:
set_mai() --> public
set_tum() --> public
set_show() --> public
*/