Python OOP Guide Abstract Polygons Edition (1)
Python OOP Guide Abstract Polygons Edition (1)
● Abstract Base Class (ABC): Base class can't be used directly; it defines a
contract.
● Polymorphism: Each subclass implements its own version of a shared method.
● Inheritance: Specific shapes are derived from a generic geometric base.
Polymorphic Behavior
● Regardless of which shape the user selects, the program calls the same
methods on the object.
● Python dynamically figures out which version (triangle, rectangle, etc.) to run —
this is runtime polymorphism.
Quick Tips