Python Programming - Polymorphism - Discussion
Discussion Forum : Polymorphism - General Questions (Q.No. 13)
13.
Consider the following code:
class Vehicle:
def drive(self):
pass
class Car(Vehicle):
def drive(self):
return "Car is driving"
class Bicycle(Vehicle):
def drive(self):
return "Bicycle is pedaling"
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