Python Programming - Polymorphism - Discussion
Discussion Forum : Polymorphism - General Questions (Q.No. 75)
75.
Consider the following Python code:
class Sports:
def play(self):
return "Generic sports activity"
class Football(Sports):
def play(self):
return "Playing football"
class Basketball(Sports):
def play(self):
return "Playing basketball"
What concept is demonstrated in this code?
Answer: Option
Explanation:
This code demonstrates method overriding, where the subclasses provide specific implementations for a method defined in the superclass.
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