Multiple Inheritance

Console Output
>

Multiple Inheritance Flow

Method Resolution Order (MRO)

Bird
Animal
Flyable
object
Bird.__mro__ = (Bird, Animal, Flyable, object)
Animal (Parent 1)
name, speak(), eat()
Flyable (Parent 2)
fly(), land(), take_off()
Bird (Child)
wingspan, speak(), fly(), chirp()

Diamond Problem Awareness

When both parent classes inherit from a common base class, Python's MRO ensures the base class is only visited once to avoid conflicts.

Method Execution Flow

my_bird.speak() called
Bird.speak() executed (overrides Animal.speak())
Returns: "Bird speak method"
my_bird.fly() called
Flyable.fly() executed (inherited)
Returns: "Flying high!"

Multiple Inheritance Benefits

Combine functionality from multiple classes
Mix-in patterns for reusable behavior
Flexible class composition
MRO handles method conflicts automatically