-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmultiple_inheritance.cpp
More file actions
77 lines (75 loc) · 1.29 KB
/
multiple_inheritance.cpp
File metadata and controls
77 lines (75 loc) · 1.29 KB
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
65
66
67
68
69
70
71
72
73
74
75
76
77
#include<iostream.h>
#include<conio.h>
class student
{
private:
int rollno;
char name[15];
public:
void getinfo();
void show();
};
class mark
{
protected:
int m1,m2,m3;
public:
void getdata();
void display();
};
class result:public student,public mark
{
private:
int total;
public :
void gettotal();
void showtotal();
};
void student::getinfo()
{
cout<<"enter Roll number of student";
cin>>rollno;
cout<<"enter name of student ";
cin>>name;
}
void mark::getdata()
{
cout<<"enter marks of three subject "<<endl;
cout<<"enter marks of first subject";
cin>>m1;
cout<<"enter marks of second subject";
cin>>m2;
cout<<"enter marks of third subject";
cin>>m3;
}
void student::show()
{
cout<<"\n\nRoll number of Student is:- "<<rollno<<endl;
cout<<"Name of Strudent is:- "<<name<<endl;
}
void mark::display()
{
cout<<"Marks of Three subjects are"<<endl;
cout<<"Marks of First subject is:- "<<m1<<endl;
cout<<"Marks of Second subject is:- "<<m2<<endl;
cout<<"Marks of Third subject is:- "<<m3<<endl;
}
void result::gettotal()
{
getinfo();
getdata();
total=m1+m2+m3;
}
void result:: showtotal()
{
show();
display();
cout<<"total of Marks is:-"<<total;
}
void main()
{
clrscr();
result r;
r.gettotal();
r.showtotal();
}