-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritence.cpp
More file actions
62 lines (53 loc) · 1.29 KB
/
Copy pathinheritence.cpp
File metadata and controls
62 lines (53 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
/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, COBOL, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include<iostream>
using namespace std;
class Person
{
int id;
char name[100];
public:
void set_p()
{
cout<<"Enter the Id:";
cin>>id;
fflush(stdin);
cout<<"Enter the Name:";
cin.get(name,100);
}
void display_p()
{
cout<<endl<<id<<"\t"<<name<<"\t";
}
};
class Student: private Person
{
char course[50];
int fee;
public:
void set_s()
{
set_p();
cout<<"Enter the Course Name:";
fflush(stdin);
cin.getline(course,50);
cout<<"Enter the Course Fee:";
cin>>fee;
}
void display_s()
{
display_p();
cout<<course<<"\t"<<fee<<endl;
}
};
main()
{
Student s;
s.set_s();
s.display_s();
return 0;
}