-
Notifications
You must be signed in to change notification settings - Fork 10
/
hyrichal.cpp
68 lines (67 loc) · 1.05 KB
/
hyrichal.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
65
66
67
68
#include<iostream.h>
#include<conio.h>
class father
{
char name[30];
int age;
public:
void getdata()
{
cout<<"enter father name";
cin>>name;
cout<<"enter father age";
cin>>age;
}
void display()
{
cout<<"father name"<<name<<endl;
cout<<"father age"<<age<<endl;
}
};
class son:public father
{
char name[30];
int marks;
public:
void getdata()
{
cout<<"enter son name";
cin>>name;
cout<<"enter son marks";
cin>>marks;
}
void display()
{
cout<<"son name and marks"<<name<<endl<<marks<<endl;
}
};
class daughter:public father
{
char name[30];
int marks;
public:
void getdata()
{
cout<<"enter daughter name";
cin>>name;
cout<<"enter daughter marks";
cin>>marks;
}
void display()
{
cout<<"daughter name and marks"<<name<<endl<<marks<<endl;
father::getdata();
father::display();
}
};
void main()
{
clrscr();
daughter d1;
d1.getdata();
d1.display();
son s1;
s1.getdata();
s1.display();
getch();
}