Skip to content

Commit a06064b

Browse files
authored
Merge pull request cherryWood55#17 from hunarjain007/organizeSubfolders
organised code into sub-folders
2 parents 66472e8 + a9fe64e commit a06064b

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
class Parent():
2-
def __init__(self, last_name, eye_color):
3-
print ("Parent Constructor Called")
4-
self.last_name = last_name
5-
self.eye_color = eye_color
6-
7-
def show_info(self): # This method is also available to class Child
8-
print (self.last_name)
9-
print (self.eye_color)
10-
11-
class Child(Parent):
12-
13-
def __init__(self, last_name, eye_color, number_of_toys):
14-
print ("Child Constructor Called")
15-
Parent.__init__(self, last_name, eye_color)
16-
self.number_of_toys = number_of_toys
17-
18-
def show_info(self): # Method Overriding (ability of a subclass to override a method defined in the parent class)
19-
print (self.last_name)
20-
print (self.eye_color)
21-
print (self.number_of_toys)
22-
23-
billy_cyrus = Parent ("Cyrus", "Blue")
24-
miley_cyrus = Child ("Cyrus", "blue", 5)
25-
#print (miley_cyrus.last_name)
26-
#print (miley_cyrus.number_of_toys)
27-
28-
29-
#print (billy_cyrus.eye_color)
30-
31-
miley_cyrus.show_info()
1+
class Parent():
2+
def __init__(self, last_name, eye_color):
3+
print ("Parent Constructor Called")
4+
self.last_name = last_name
5+
self.eye_color = eye_color
6+
7+
def show_info(self): # This method is also available to class Child
8+
print (self.last_name)
9+
print (self.eye_color)
10+
11+
class Child(Parent):
12+
13+
def __init__(self, last_name, eye_color, number_of_toys):
14+
print ("Child Constructor Called")
15+
Parent.__init__(self, last_name, eye_color)
16+
self.number_of_toys = number_of_toys
17+
18+
def show_info(self): # Method Overriding (ability of a subclass to override a method defined in the parent class)
19+
print (self.last_name)
20+
print (self.eye_color)
21+
print (self.number_of_toys)
22+
23+
billy_cyrus = Parent ("Cyrus", "Blue")
24+
miley_cyrus = Child ("Cyrus", "blue", 5)
25+
#print (miley_cyrus.last_name)
26+
#print (miley_cyrus.number_of_toys)
27+
28+
29+
#print (billy_cyrus.eye_color)
30+
31+
miley_cyrus.show_info()
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)