Method Overriding means having multiple methods with the same signature, one method to be present in base class and the other in derived class. This can be achieved by using Virtual and Override keywords. Here, the same signature applies to:
- Method Name
- Method Return Type
- Number of Parameters
- Types of Parameters
Method overloading is sometimes called Dynamic Polymorphism or Run Time Polymorphism or Late Binding. It means creating virtual methods in the base class and overriding the same method in a derived class. The overriding is used to modify the implementation of the base class. This implementation can be achieved by using either Abstract or Virtual keywords.
- using System;
- namespace Overridding {
- class Circle {
- public virtual double Area(double r) {
- return Math.PI * r * r;
- }
- }
- class Sphere: Circle {
- public override double Area(double r) {
- return 4 * base.Area(r);
- }
- }
- class Program {
- static void Main(string[] args) {
- Circle C = new Sphere();
- double area = C.Area(4);
- Console.WriteLine(area);
- }
- }
- }

Prasad KrishnaraoPosted Mar 20, 2018, 10:48 AM
Thanks for the article
Bhavesh JadavPosted Mar 18, 2018, 11:22 PM
Very good explanation, thanks to share it