Overloading in Inheritance

This Article will explain you how we can achieve Overloading in  Inheritance

 public class Base  
{
public Base()
{ Console.WriteLine("Base Constructor"); }
public void display()
{
Console.WriteLine("Nirbhay from base");
}
}
-------------------------------------------------------------------------------------------------------------
public class Child:Base
{
public Child()
{
Console.WriteLine("Child Constructor");
}
public void display(string name)
{
Console.WriteLine("Child " + name);
}
public void display(int number)
{
Console.WriteLine("Child " + number);
}
}
--------------------------------------------------------------------------------------------------------------
class Program
{
static void Main(string[] args)
{
Child obj = new Child();
obj.display();
obj.display(12);
obj.display("nirbhay");
Console.ReadLine();
}
}

Published by Nirbhay

Technology Geek,Blogger,Reviewer

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: