-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathover_riding.py
More file actions
27 lines (21 loc) · 874 Bytes
/
over_riding.py
File metadata and controls
27 lines (21 loc) · 874 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
class employee:
def setnumberofworkinghours(self):
self.numberofworkinghours = 40
def displaythenumberofworkinghours(self):
print(self.numberofworkinghours)
class trainee(employee): # 2nd ------
def setnumberofworkinghours(self):
self.numberofworkinghours = 45
def resetnumberofworkinghours(self): # 3rd--------
super().setnumberofworkinghours() #super takes to the original value
obj=employee()
obj.setnumberofworkinghours()
print("number of working hours: ", end =" ")
obj.displaythenumberofworkinghours()
Trainee=trainee() #2------
Trainee.setnumberofworkinghours()
print("Number of working hours of trainee ", end="")
Trainee.displaythenumberofworkinghours()
Trainee.resetnumberofworkinghours() #3----------
print("Number of working hours has been reset: ", end=" ")
Trainee.displaythenumberofworkinghours()