How do you create multiple inheritance in C#?
Answer Posted / pavankumar
C# doesn't support Multiple Inheritance,,,SO to over come this problem Interface came into picture.Interface is not a class,but it is a parent to base class.
Interface Forest
{
void Greet();
}
class Animal: Forest
{
public void Greet()
{
Console.WriteLine("Animal says Hello");
}
public void Sing()
{
Console.WriteLine("Animal Sings");
}
}
class Program : Animal,Forest
{
static void Main(string[] args)
{
Program obj = New Program();
obj.Greet();
obj.Sing();
Console.ReadLine();
}
}
Is This Answer Correct ? | 5 Yes | 3 No |
Post New Answer View All Answers
Is array thread safe c#?
what is method overloading in c#?
What framework is used for performance testing/load testing?
What is indexer c#?
What is data bind in c#?
Name the connections does microsoft sql server support?
Can you instantiate an abstract class c#?
What is sorting in c#?
What is lazy in c#?
Define delay signing?
How do I move from one form to another in c#?
Explain the three test cases in unit testing?
What are native functions?
What is msil in c#?
What is IL / CIL / MSIL?