Oops 3 01
Oops 3 01
Eg1: Yourself is best example of polymorphism.In front of Your parents You will have one type of
behaviour and with friends another type of behaviour.Same person but different behaviours at
different places,which is nothing but polymorphism.
Eg4: The Same method with different implementations in Parent class and child
classes.(overriding)
2. Overloading
1. Operator Overloading
2. Method Overloading
3. Constructor Overloading
3. Overriding
1. Method overriding
2. constructor overriding
def f1(obj):
obj.talk()
What is the type of obj? We cannot decide at the beginning. At runtime we can pass any type.Then
how we can decide the type?
At runtime if 'it walks like a duck and talks like a duck,it must be duck'. Python follows this
principle. This is called Duck Typing Philosophy of Python.
nd
DURGASOFT, # 202, 2 Floor, HUDA Maitrivanam, Ameerpet, Hyderabad - 500038,
1 040 – 64 51 27 86, 80 96 96 96 96, 92 46 21 21 43 | www.durgasoft.com