Python Programming - Polymorphism - Discussion
Discussion Forum : Polymorphism - General Questions (Q.No. 65)
65.
Consider the following code:
class Shape:
def draw(self):
return "Drawing a shape"
class Triangle(Shape):
def draw(self):
return "Drawing a triangle"
class Rectangle(Shape):
def draw(self):
return "Drawing a rectangle"
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