-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinheritance.py
More file actions
30 lines (24 loc) · 846 Bytes
/
Copy pathinheritance.py
File metadata and controls
30 lines (24 loc) · 846 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
class Parent():
def __init__(self, lastName, eyeColor):
print("Parent Constructor called")
self.lastName = lastName
self.eyeColor = eyeColor
def showInfo(self):
print("Last Name: " + self.lastName)
print("Eye Color: " + self.eyeColor)
class Child(Parent):
def __init__(self, lastName, eyeColor, toys):
print("Child Constructor called")
Parent.__init__(self, lastName, eyeColor)
self.toys = toys
def showInfo(self):
print("Last Name: " + self.lastName)
print("Eye Color: " + self.eyeColor)
print("Toys: " + str(self.toys))
billyCyrus = Parent("Cyrus", "green")
#print(billyCyrus.lastName)
#billyCyrus.showInfo()
mileyCyrus = Child("Cyrus", "blue", 7)
mileyCyrus.showInfo()
#print(mileyCyrus.lastName)
#print(mileyCyrus.toys)