Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Method Overirding and Overloading

using System.IO;
using System;

namespace consoleapplication
{
    public class A
    {
        public virtual void Display()
        {
            Console.WriteLine("ParentClass A");
        }
    }
    public class B:A
       {
           public override void Display()
           {
               Console.WriteLine("ChildClass B");
           }
       }
       class program
       {
           static void Main()
           {
               B obj = new B();
               obj.Display();
               Console.ReadLine();
           }
       }
}



public class Methodoveloading    
  {    
    public int add(int a, int b)  //two int type Parameters method  
    {    
        return a + b;    
        
    }    
    public int add(int a, int b,int c)  //three int type Parameters with same method same as above  
    {    
        return a + b+c;    
    
    }    
    public float add(float a, float b,float c,float d)  //four float type Parameters with same method same as above two method 
    {    
        return a + b+c+d;    
    
    }    
  }    

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.