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 |
What is get set in c#?
why c# is pronounced as C-sharp instead of pronouncing it as C-hash? is there any technical reason behind it?
Can properties be overloaded in c#?
the c# keyword .int. Maps to which .net type?
When you inherit a protected class-level variable, who is it available to?
How the versioning applies to Assemblies or can you explain version numbers?
explain DIFFERENCE BETWEEN CLASS AND MODULE?
Enlist some of the properties of a thread class?
How many root nodes are there in an xml document?
What are the types of operator?
What?s the data provider name to connect to Access database?
What is a .aspx file?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)