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 ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is expandoobject in c#?
Explain the importance and use of each, version, culture and publickeytoken for an assembly.
What is nameof c#?
Explain the accessibility modifier protected internal?
Explain the concepts of cts and cls(common language specification).
Is it possible to inline assembly or il in c# code?
Is c# a backend language?
What are the Types of optimization and name a few and how do u do?
What are the properties of c#?
What is cshtml extension?
What is static classes in c#?
Is array passed by reference in c#?
Wcf and what is difference between wcf and web services?
What is difference between asp net and c# net?
Tell me the difference between call by value and call by reference.