-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path4Abstraction.cpp
59 lines (44 loc) · 1.25 KB
/
4Abstraction.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
//Abstraction means hiding the complex thing behind a procedure that make those things looks simple
//Example-mobile(use is easy but functionality that is hidden is complex)
#include<bits/stdc++.h>
using namespace std;
//class is bluprint of object
class AbstractEmployee{ //Abstarct class
//making this function obligatory (means neccesary)
virtual void GetPromotion()=0;
};
class Employee:AbstractEmployee{ //my class has signed contract name Abstracct class
public:
string Name;
string Company;
int Age;
void Indroduction(){
cout<<"Name:"<<Name<<endl;
cout<<"Company:"<<Company<<endl;
cout<<"Age:"<<Age<<endl;
}
Employee(){ //for E1,E2,E4
cout<<"inside default constructor"<<endl;
}
Employee(string name, string company,int age){ //E3 is using this Constructor
Name=name;
Company=company;
Age=age;
}
void GetPromotion(){
if(Age>=30){
cout<<"you are promoted"<<endl;
}
else{
cout<<"not promoted"<<endl;
}
}
};
int main(){
Employee E1("riya" ,"deshaw",19);
E1.Indroduction();
Employee E2("jain","gs",30);
E2.Indroduction();
E1.GetPromotion();
E2.GetPromotion();
}