-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInheritence.cpp
54 lines (46 loc) · 1.09 KB
/
Inheritence.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
#include<iostream>
#include "Class.cpp"
#define sp " "
#define endl "\n"
using namespace std;
class Inheritence : private Demo{
private:
int id;
protected:
const string s {"Rahul"};
public:
Inheritence(int a, int b, int id) : Demo(a, b) {
this->id = id;
}
void getValue(){
// Demo::getNumbers();
cout<<"From Base Class : "<<y<<sp<<z<<endl;
cout<<id<<endl;
cout<<this->getString()<<endl;
}
string getString(){
return this->s;
}
const static void output(){
cout<<"Program coded by Rahul Bordoloi."<<endl;
}
};
int extern classNumber;
int main()
{
/*
Demo obj;
obj.displayCount();
Demo obj2, obj3;
obj.getNumbers();
obj.output("Rahul");
// obj3.output("Bordoloi");
obj3.displayCount();
*/
Inheritence obj(7,8,9);
obj.getValue();
Demo::output("Hehehehahahaohoho");
cout<<classNumber<<endl;
Inheritence::output();
return 0;
}