As Ikke said, Multiple inheritance has nothing to do with polymorphism.
If I could draw a class diagram, Multiple Inheritance looks like this:
Base A Base B ^ ^ \ / \ / Child
So, the Child class inherits both attributes and behavior of both classes. Many languages, such as Java and PHP, do not allow this, but Python.
Polymorphism , on the other hand, is when you can ignore specialization. First of all, the class diagram:
Animal ^ ^ / \ / \ Cat Dog
And you can do the following:
// Assuming we have a pack of animals // This is Java for (Animal pet : pack) pet.speak();
Each pet will say different things depending on the implementation.
source share