Polymorphism in .Net and Types of Polymorphism in .Net
Polymorphism means having more than one form.
It means same operation may behave differently on different classes.
It is classified into compile time polymorphism or early binding or static binding and Runtime polymorphism or late binding or dynamic binding.
1) Static/early Binding /Compile Time Polymorphism:
The mechanism of linking function with an object during compile time is called as static or early binding.
Ex: Method overloading and operator overloading.
Two or more functions having save name, but they are differ in thier function signature is called as Method\function overloading.
Function signature means: They can differ in Number of parameters, sequence of parameter & data type of parameter.
Method Overloading forms compile-time polymorphism.
2) Dynamic/Late Binding / Run Time Polymorphism:
The mechanism of linking function with an object during run time is called as dynamic or late binding.
Ex: Method overriding / virtual functions / abstract classes
Method overriding occures when child class delcares a method with same name & signature as parent class.
Here parent class must declares the method with virtual or overridable keyword, and child class must uses override keyword.
Please look example as below,