Professional Documents
Culture Documents
Lecture 23 Polymorphism
Lecture 23 Polymorphism
Lecture 23 Polymorphism
Polymorphism
• World Polymorphism comes form
• Poly + morph
c.go()
c.turnLeft()
c.turnRight()
d.go()
d.turnLeft()
d.turnRight()
things=[]
for i in range(0,200):
if i%2==0:
things.append(Car(i))
if i%2!=0:
things.append(Boat(100+i))
for a in range(0,200):
things[a].go()
Permanent Employee
Example 2 Salary
Allowance
Employee
Get Gross Pay
Get Tax
Salary Get Net Pay
Allowance
Contract Employee