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