-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOverriding.py
75 lines (38 loc) · 1.12 KB
/
Overriding.py
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
69
70
71
72
73
74
75
class Employee:
apply_raise=1.5
def __init__(self,first,last,empid,pay):
self.first=first
self.last=last
self.empid=empid
self.pay=int(pay)
def display(self):
print("first name: ", self.first)
print("last name: ", self.last)
print("empid: ",self.empid)
print("pay: ", self.pay)
def pay_raise(self):
self.pay=int(self.pay)*self.apply_raise
class Developer(Employee):
apply_raise=2.5
def __init___(self,first,last,empid,pay):
super().__init__(first,last,empid,pay)
def pay_raise(self):
self.pay=int(self.pay)*self.apply_raise
class Manager(Employee):
apply_raise=3.5
def __init___(self,first,last,empid,pay):
super().__init__(first,last,empid,pay)
def pay_raise(self):
self.pay=int(self.pay)*self.apply_raise
e1=Employee("akash","dallen","101",10000)
print(e1.pay)
e2=Developer("nagendra","herle","102",10000)
print(e2.pay)
e3=Manager("vaibhav","hatwar","103",10000)
print(e3.pay)
e1.pay_raise()
e2.pay_raise()
e3.pay_raise()
e1.display()
e2.display()
e3.display()