- -
UPV
 

Polymorphism and multiple inheritance

In this video polymorphism in object-oriented programming is explained. Polymorphic methods can be created in two ways: by inheritance or by using the same method name with different parameters. The video demonstrates an example of polymorphism with a figure class and its subclasses, circle and rectangle, where each subclass implements specific area and perimeter calculations. The video also covers partial overriding of methods using the super keyword and multiple inheritance, where a class can inherit from multiple classes at once. However, this can lead to conflicts if both classes have the same method declarations, which Python resolves by prioritizing the leftmost parent class. Lastly, an example is shown of how to use multiple inheritance to create a positioned figure class that inherits from both the figure and position classes, allowing it to have both color and position attributes.


EMAS upv