Overloading

Overriding

Polymorphism:

Compile Time Polymorphism

Run Time Polymorphism

Binding:

Early / Static  Binding

Late / Dynamic Binding

  Method overloading is creating a method with the same name within the same class having different signatures. In method overriding, we change the method definition in the derived class that changes the method behavior.
Function Parameters:

Functions with same name and different parameters.

Functions in the extended class with same name and same parameters as in the base class, but with different behaviors.

Code Snippet:

 public class A
 {
 public void Print(int x)
 {
  Console.WriteLine("Parent Method");
 }
 }
 public class B : A
 {
 public void child()
 {
  Console.WriteLine("Child Method");
 }
 public void Print(float x)
 {
  Console.WriteLine("Overload child method");
 }
 public void Print(string str)
 {
  Console.WriteLine("Overload child method  " + str);
 }
 }

//Lets execute code
B b= new  B();
b.Print(10);
//Output- Parent Method
b.Print(10.20);
//Output-Overriding child method
b.Print("Hello");
//Output-Overriding child method Hello

public class A
 {
 public virtual void Print()
 {
  Console.WriteLine("Parent Method");
 }
 }
 public class B : A
 {
 public void child()
 {
  Console.WriteLine("Child Method");
 }
 public override void Print()
 {
  Console.WriteLine("Overriding child method");
 }
 }

  //Lets execute code
  A a = new A();
  a.Print();
  //Output- Parent Method
  a = new B();
  a.Print();
  //Output-Overriding child method