How do you create multiple inheritance in C#?

Answers were Sorted based on User's Feedback



How do you create multiple inheritance in C#?..

Answer / p.senthil

C# doesnt support multiple inheritance. So using interfaces
to solve that problem

Is This Answer Correct ?    5 Yes 0 No

How do you create multiple inheritance in C#?..

Answer / mukesh

C# doesnt support multiple inheritance. by using interfaces
to solve that problem. C# supports multilevel inheritance.

Is This Answer Correct ?    3 Yes 0 No

How do you create multiple inheritance in C#?..

Answer / 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

How do you create multiple inheritance in C#?..

Answer / satish

By using interfaces

Is This Answer Correct ?    2 Yes 1 No

How do you create multiple inheritance in C#?..

Answer / arunkumar.v

C# doesnt support multiple inheritence ie.,it doesnt
inherit multiple base class.It generally creates confusion.
Instead you can use Interfaces.You are permitted to inherit
one base class and multiple interfaces.

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More C Sharp Interview Questions

Using system; class main { public static void Main() { int a = 1; for (int i = 0; i < 10; i++) { int j = a * 5; Console.WriteLine(a + "*5=" + j); a++; } Console.ReadLine(); } }

1 Answers  


Explain use of abstract and sealed classes in c#?

0 Answers  


Can fields inside a class be virtual?

0 Answers  


What is a console in c#?

0 Answers  


How many keyword present in C# language ?

0 Answers   HCL,






Explain About web methods and its various attributes

0 Answers   Digital GlobalSoft,


Why objects are stored in heap in c#?

0 Answers  


What basic steps are needed to display a simple report in crystal?

0 Answers  


What is the purpose of dependency injection?

0 Answers  


Can a static class have a constructor c#?

0 Answers  


What is event and delegates in c#?

0 Answers  


What is datetime parse in c#?

0 Answers  


Categories