C# Concepts – Polymorphism

In this article I will explain what is polymorphism & types of polymorphism.

What is Polymorphism ?
In Polymorphism ‘poly’ means ‘many’ and ‘morph’ means ‘forms’ so polymorphism means many forms.

Basically There are two types of Polymorphism

  1. Compile Time Polymorphism
  2. Run Time Polymorphism

Compile Time Polymorphism
It is also known as ‘Static Polymorphism’ or ‘Early Binding’ or ‘Method Overloading’.
In Method Overloading or Compile Time polymorphism or Static Polymorphism we create multiple methods with same name but with different signatures.

Run Time Polymorphism
It is also known as ‘Dynamic Polymorphism’ or ‘Late Binding’ or ‘Method Overriding’.
In Method Overriding or Run Time Polymorphism or Dynamic Polymorphism we create method in base class & we can override same method in derived class using ‘Virtual’ or ‘Override’ keywords.
There are two ways or doing

  1. Virtual Functions
  2. Abstract Class

admin