-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMulti_Level_Inheritance.cpp
More file actions
51 lines (43 loc) · 914 Bytes
/
Copy pathMulti_Level_Inheritance.cpp
File metadata and controls
51 lines (43 loc) · 914 Bytes
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
#include <bits/stdc++.h>
using namespace std;
class Person
{
public:
string name;
int age;
Person(string name, int age)
{
this->name = name;
this->age = age;
}
};
class Student : public Person
{
public:
int rollno;
Student(string name, int age, int rollno) : Person(name, age)
{
this->rollno = rollno;
}
};
class GrandStudent : public Student
{
public:
string research_paper;
GrandStudent(string name, int age, int rollno, string research_paper) : Student(name, age, rollno)
{
this->research_paper = research_paper;
}
void getInfo()
{
cout << "name : " << name << endl;
cout << "agen : " << age << endl;
cout << "rollno : " << rollno << endl;
cout << "research_paper : " << research_paper << endl;
}
};
int main()
{
GrandStudent s1("Soumyadip", 23, 121, "AI_Intregation");
s1.getInfo();
}