---
title: "Polymorphism"  
description: "When a message can be processed in different ways is called polymorphism. Polymorphism means many forms.  Polymorphism is one of the fundamental conce"  
author: "Amit Singh"  
published: 2010-10-07  
updated: 2014-09-18  
canonical: https://www.mindstick.com/blog/18/polymorphism  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# Polymorphism

When a message can be processed in different ways is called polymorphism. Polymorphism means many forms. Polymorphism is one of the fundamental [concepts](https://www.mindstick.com/articles/13127/macro-and-microeconomics-concepts-in-relation-to-global-organization-management) of OOP.\

##### Polymorphism provides following features:

##### · It allows you to invoke method of derived class through base class

##### reference during runtime.

##### · It has the ability for classes to provide different implementations of

##### methods that are through the same name.

##### Polymorphism is of two types:

##### \
(1) Compile Time polymorphism /Overloading

##### \
(2) Runtime Polymorphism/ Overriding

##### \

##### Compile Time polymorphism:

Compile Time polymorphism is method and [operators](https://www.mindstick.com/articles/716/php-operators) overloading. It is also called early binding.

In [method overloading](https://www.mindstick.com/articles/12033/method-overloading-in-c-sharp) method performs the different task at the different input parameters.

##### Compile Time polymorphism:

Compile Time polymorphism is done using [inheritance](https://www.mindstick.com/articles/13095/inheritance-and-its-types) and [virtual functions](https://www.mindstick.com/forum/159480/explain-the-purpose-of-the-virtual-keyword-and-virtual-functions-in-c-plus-plus). [Method overriding](https://www.mindstick.com/articles/12227/method-overloadind-and-method-overriding-in-c-sharp) is called runtime polymorphism. It is also called binding.

When overriding a method, you can change the behavior of the method for the [derived class](https://answers.mindstick.com/qa/30686/what-is-a-base-class-and-derived-class). **Overloading** a method simply involves having another method with same prototype.

##### Example:

```
Public class print{Public void display(string name){Console.WriteLine(“Your name is :” +name); } Public void display(int age, flot markes) { Console.WriteLine(“Your age is :” +age); Console.WriteLine(“Your mark is :” +marks);  } }Static void main(){Print  obj=new print();Obj.display(“Mind Stick”);Obj.display(25,76.50f);Console.ReadLine();}}}
```

##### You can also read these related post

[https://www.mindstick.com/blog/506/polymorphism-in-c-sharp](https://www.mindstick.com/blog/506/polymorphism-in-c-sharp)

[https://www.mindstick.com/Articles/32/polymorphism](https://www.mindstick.com/Articles/32/polymorphism)\

[https://www.mindstick.com/interview/81/what-is-meant-by-polymorphism](https://www.mindstick.com/interview/81/what-is-meant-by-polymorphism)*\*

---

Original Source: https://www.mindstick.com/blog/18/polymorphism

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
