Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What is Interface Polymorphism?with E.g



What is Interface Polymorphism?with E.g..

Answer / sandeep negi

//Consider IShape interface like this

interface IShape
{string CalculateArea();}

class Circle : IShape
{
public string CalculateArea(){return "Circle area";}
}

class Rectangle : IShape
{
public string CalculateArea(){return "Rectangle
area";}
}


//implement function
private string ProcessArea(IShape shape)
{return shape.CalculateArea();}

//call this function from main or from button click event
like this

private void button1_Click(object sender, EventArgs e)
{
Rectangle r = new Rectangle();
Circle c = new Circle();
MessageBox.Show(ProcessArea(r));
MessageBox.Show(ProcessArea(c));
}

Is This Answer Correct ?    3 Yes 2 No

Post New Answer

More C Sharp Interview Questions

What is get set in c#?

0 Answers  


why c# is pronounced as C-sharp instead of pronouncing it as C-hash? is there any technical reason behind it?

3 Answers  


Can properties be overloaded in c#?

0 Answers  


the c# keyword .int. Maps to which .net type?

0 Answers   Siebel Systems,


When you inherit a protected class-level variable, who is it available to?

2 Answers  


How the versioning applies to Assemblies or can you explain version numbers?

0 Answers   CitiusTech,


explain DIFFERENCE BETWEEN CLASS AND MODULE?

3 Answers  


Enlist some of the properties of a thread class?

0 Answers  


How many root nodes are there in an xml document?

0 Answers  


What are the types of operator?

0 Answers  


What?s the data provider name to connect to Access database?

6 Answers  


What is a .aspx file?

0 Answers  


Categories