-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathex44.py
More file actions
33 lines (24 loc) · 757 Bytes
/
ex44.py
File metadata and controls
33 lines (24 loc) · 757 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
class Other(object):
# defines the functions of the PARENT class
def override(self):
print("OTHER override()")
def implicit(self):
print("OTHER implicit()")
def altered(self):
print("OTHER altered()")
# creates a class that inherits the functions from the PARENT
class Child(object):
def __init__(self):
self.other = Other()
def implicit(self):
self.other.implicit()
def override(self):
print("CHILD override()")
def altered(self):
print("CHILD, BEOFRE OTHER altered()")
self.other.altered()
print("CHILD, AFTER OTHER altered()")
son = Child()
son.implicit()
son.override()
son.altered()