Professional Documents
Culture Documents
Polymorphsm
Polymorphsm
Agenda
3-4
Polymorphism Example
3-5
Polymorphism Examples
Example 1: Polymorphism
3-7
Example 1: Polymorphism
3-8
Example 1: Polymorphism
3-9
Example 1: Polymorphism
3-10
Example 2: Polymorphism
3-11
Example 2: Polymorphism
3-12
Dynamic binding
Static and dynamic binding
Static binding:
• Which Method will be invocated will be
determined at compile time.
Dynamic binding:
• Which Method will be invocated will be
determined at runtime time.
3-14
Static and dynamic binding
Note :
• Method invocations allowed by the compiler are
based solely on the declared type of the
reference, regardless of the object type
• Which overridden version of the method to call (in
other words, from which class in the inheritance
tree) is decided at runtime based on object type
3-16
Static and dynamic binding
Compiler
error
3-17
Questions
Thanks