Professional Documents
Culture Documents
Polymorphism Lec 12
Polymorphism Lec 12
Polymorphsim
Recap
• Polymorphism allows objects of different classes to be treated as
objects of a common superclass
• Method overriding helps in this by Dynamic Method Dispatch
• Allows code to be written at super class level without knows the
implementation of subclass
• Example
• Parent Class: Shape with a method area
• Child Classes: Rectangle, Square, Triangle etc can override them according to their
needs.
Can not be instantiated