Header Ads

  • Breaking Now

    What is Polymorphism/Late Binding?

    When an object is sent a message then it does not know itself what type it is, the runtime environment will decide about function calling over an object. This feature of connecting an object with its associated message at runtime is known as Polymorphism or Late binding or Dynamic binding.


    1. Nishanth Thomas ,BangaloreJuly 4, 2010 at 10:58 AM

      The ability to take more than one form is called Polymorphism, sigle function may handle different objects.

    2. Super-class's instance variable can point to objects of any of its sub-class's object at run-time. IE we can assign object of any sub-class to the instance variable of super-class at run-time. IE instance variable of a super-class can know where to point only at run-time and not at compile time. This is called Late Binding.

      It can also be treated as Polymorphism, as same instance variable of super-class can point objects of different sub-classes [one at a time] thus having different forms.

      Polymorphism means single name and many forms.

    3. method overloading is the example for polymorphism.

    4. Single function have the ability to perform the different different task is called polymorphism (one name multiple forms).
      Type of polymorphism
      - compile time and
      - run time polymorphism.
      we can achieve compile time polymorphism through function overloading and run time polymorphism through function overriding.


    Post Top Ad

    Post Bottom Ad