Python Programming - Inheritance - Discussion
Discussion Forum : Inheritance - General Questions (Q.No. 72)
72.
Consider the following code:
class Shape:
def __init__(self, color):
self.color = color
class Circle(Shape):
def __init__(self, radius, color):
super().__init__(color)
self.radius = radius
What is the purpose of using super().__init__(color)
in the Circle
class?
Answer: Option
Explanation:
super().__init__(color)
is used to call the constructor of the superclass Shape
and initialize the color attribute.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers