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


Please Help Members By Posting Answers For Below Questions

What the different phase/steps of acquiring a proxy object in webservice?

447


Can list contain duplicates c#?

472


Can constructor be protected?

445


How are methods overloaded?

524


What is a clr (common language runtime)?

465






Explain the difference between proc. Sent by val and by sub?

457


To allow an element to be accessed using a unique key which .NET collection class is used ?

597


Are constructors inherited c#?

487


What is eager loading in c#?

446


What is dll in c#?

483


How does one compare strings in c#?

527


What is an event in c#?

480


Describe the overview of clr integration.

474


What are the collections in c#?

445


What is the components of window?

481