Python Programming - Polymorphism - Discussion

Discussion Forum : Polymorphism - General Questions (Q.No. 3)
3.
Consider the following code:
class Shape:
    def area(self):
        pass

class Circle(Shape):
    def area(self, radius):
        return 3.14 * radius * radius

class Rectangle(Shape):
    def area(self, length, width):
        return length * width
What is this example illustrating?
Operator overloading
Method overloading
Method overriding
Polymorphism
Answer: Option
Explanation:
This example illustrates method overriding, where a subclass provides a specific implementation for a method that is already defined in its superclass.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.