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


Please Help Members By Posting Answers For Below Questions

Is array thread safe c#?

482


what is method overloading in c#?

543


What framework is used for performance testing/load testing?

1482


What is indexer c#?

467


What is data bind in c#?

522






Name the connections does microsoft sql server support?

486


Can you instantiate an abstract class c#?

505


What is sorting in c#?

521


What is lazy in c#?

513


Define delay signing?

534


How do I move from one form to another in c#?

468


Explain the three test cases in unit testing?

594


What are native functions?

472


What is msil in c#?

550


What is IL / CIL / MSIL?

667