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
Why is c# used?
What is generic collection in c#?
What is an inheritance in c#?
Explain the Abstract class in c#.net
How can it prevents DLL Hell assembly versioning in .NET?
What is difference between il and dll ?
What are the advantages of using c#?
Can dictionary have duplicate keys c#?
How much time will it take to learn unity?
What is Assembly. and Describe type of assembly. why most developer happy with private assembly.
What language is c# similar to?
What is the task perform by clr?
What is dao in c#?
What is ac callback?
What are some examples of desktop applications?