Abstract Base Class Polymorphism

Mon 10 August 2026
from abc import ABC, abstractmethod

class Shape(ABC):
    @abstractmethod
    def area(self):
        pass

class Rectangle(Shape):
    def area(self):
        return 10 * 5

shape = Rectangle()
print(shape.area())
50


Score: 10

Category: chapter4_polymorphism