Sunday, March 4, 2018

Tutorial 13 What is Polymorphism in Dotnet? 2nd pillar of OOPS concept

What is Polymorphism ?

Polymorphism is a feature provided by OOPS concept to use functions in base class and derived class with same name.

To use this concept we need to use virtual and override keyword infront of methods.

In below screenshot of program we had created a array of base class and tried to implement polymorphism.


What is the difference between method hiding and method overloading?

If you check in depth both are doing a same task and giving us a opportunity to check which function or method we want to use base or derived one.

Method hiding will use new keyword in derived class.

Method over loading will use virtual and over ride keyword to do the task.

What is Method OverLoading ?

This is a very simple concept but very effective technique in Dotnet.

You can define same method with different parameters in dotnet. Lets see it in example.


No comments:

Post a Comment