CMPE-103-Module-7-Method-Overloading-and-Overriding
CMPE-103-Module-7-Method-Overloading-and-Overriding
Module 7
METHOD OVERLOADING AND
OVERRIDING
At the end of the module, you should be able to:
● Recall the concept of Polymorphism
● discuss the two types of Polymorphism
● discuss the concept of Method Overloading
● demonstrate application programs on Method
Overloading
● discuss the concept of Method Overriding
Polymorphism
The word “POLYMORPHISM” comes from two Greek words
POLY and MORPHISM” which means many forms. It is
important feature in Python that allows us to define
methods in the child class with the same name as defined in
their parent class.
There are two types of Polymorphism:
(1) Overloading
(2) Overriding
Feature Method Overriding Method Overloading
To change or extend the behavior of To allow different ways to call a method with
Purpose
an inherited method. different parameters.
is used when you need to change the allows you to create multiple methods with the
Summary behavior of inherited methods in a same name but different parameters.
subclass. (not directly supported in Python).
Method Overloading