Wednesday 19 August 2015

What is polymorphism in C#.net

Polymorphism
                         Entities can behave different ways depending upon the input it receives it can be implement it  object -oriented programming using overloading and overriding.

polymorphism  can be Clasified into two types :
  1. Static or Compile Polymorphism
  2. Dynamic or Runtime Polymorphism
               In the 1st case the object of the class recognizes which polymorphic method it has to invoke at the time of compilation of the program only. Where Method Overloading under Static  or compile time polymorphism.
              
              In the 2nd case the object of the class recognizes which polymorphic method it has to call only in run time. Where  method overriding and method hiding comes under Dynamic or run time polymorphism.
             
overloading : 
                        This allows to define multiple methods in a class with the same name by changing their signatures 
 overloading is the two types :
  1.      Method overloading
  2.      Constructor overloading
overriding :
                    If a method of a class is redefine under it's child class with the same signature.it's known as method overriding.

No comments:

Post a Comment