Thursday, September 25, 2014

About Polymorphism

One of the key aspect of OOPs is ineluctably  the Polymorphism. What is it ? How is it implemented ?
the phenomenon where the same message sent to two different objects produces two different set of actions. Polymorphism is generally divided into two parts:
  • Static polymorphism : .An entity existing in different physical forms simultaneously. Here the response to message is decided on compile-time. E.g: Overloading (methods, operator). Method overloading  creates a new method with the same name and different signature. It uses early binding.
  • Dynamic polymorphism : An entity changing its form depending on the circumstances. Here  the response to message is decided on run-time. E.g: Overriding (methods). Method overriding  is the process of giving a new definition for an existing method in its derived class. A class that declares or inherits a virtual function is called a polymorphic class.
This post is intended to be a discussion topic, feel free to drop your comment...

No comments:

Post a Comment