CJCoding With Joseph
15free / daySign inCreate account
← Back to Question List
Python Code Walkthrough #44

The Parent Calls The Child

hardClasses

📄 Code

Read carefully — what does this print?
1class Shape:
2 def name(self) -> str:
3 return "shape"
4 
5 def describe(self) -> str:
6 return "I am a " + self.name()
7 
8class Circle(Shape):
9 def name(self) -> str:
10 return "circle"
11 
12print(Shape().describe())
13print(Circle().describe())
14print(Circle().name())

🎯 Your Answer