Python Programming - Inheritance - Discussion
Discussion Forum : Inheritance - General Questions (Q.No. 102)
102.
Consider the following code:
class Bird:
def __init__(self, species):
self.species = species
class Parrot(Bird):
def __init__(self, species, color):
super().__init__(species)
self.color = color
What is the primary purpose of using super().__init__(species)
in the Parrot
class constructor?
Answer: Option
Explanation:
super().__init__(species)
is used to call the constructor of the superclass Bird
and initialize the species
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