How do you create multiple inheritance in C#?
Answer Posted / neeraj tyagi
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace TestApp
{
class MultipleInheritance : first, Isecond
{
Isecond objsecond = new second();
#region Isecond Members
public void secondfunction()
{
objsecond.secondfunction();
}
#endregion
}
class first
{
public first()
{
}
public void firstfunction()
{
Console.WriteLine("First funciton called");
}
}
interface Isecond
{
void secondfunction();
}
class second : Isecond
{
public second()
{
}
public void secondfunction()
{
Console.WriteLine("Second function called");
}
}
class Program
{
static void Main(string[] args)
{
//multiple inheritance
MultipleInheritance obj = new MultipleInheritance();
obj.firstfunction();
obj.secondfunction();
Console.ReadLine();
}
}
}
Is This Answer Correct ? | 47 Yes | 19 No |
Post New Answer View All Answers
Which namespaces are necessary to create a localized application?
Explain About namespaces
Why do we need to call CG.SupressFinalize?
Define xslt.
How to use delegates with events?
What is the difference between string and stringbuilder in c#?
Is string null or empty?
Explain how to add controls dynamically to the form using c#.net.
Is python easier than c#?
Can constructor be overloaded in c#?
What is a console operator?
What does ienumerable mean?
When should we use delegates in c#?
Are structs value types c#?
Which of the following API is used to hide a window?