By Polymorphism we mean one state having different forms, polymorphism is implemented by the use of method overloading or overriding. Polymorphism is of two types which are as follows:
- Compile Type Polymorphism or Early Binding or Static Binding
This is the process whereby the compiler already identifies which method to execute at the compilation time itself. The main advantage is that the execution is much faster and the disadvantage is that it is not flexible.
Examples: Method Overloading or Overriding - Run Time Polymorphism or Late Binding or Dynamic Binding
This is the process whereby he compiler identifies which method to execute at runtime. The main advantage is that it is flexible and the disadvantage is that the execution speed is much slow.
Examples: Overridden Methods which are using the base class object
No comments:
Post a Comment