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

What is linq c#?

0 Answers  


What is difference between private and protected in c#?

0 Answers  


What is null propagation c#?

0 Answers  


What is meant by generics in c#?

0 Answers  


what will be the output of the given below coding. using System; public class Exercise { static void OddNumbers(int a) { if (a >= 1) { Console.Write("{0}, ", a); a -= 2; OddNumbers(a); } } public static int Main() { const int Number = 9; Console.WriteLine("Odd Numbers"); OddNumbers(Number); Console.WriteLine(); return 0; } }

1 Answers   iGate,






What are different types of Delegates in C#?

0 Answers   PUCIT,


What is a generic in c#?

0 Answers  


Why do we use abstraction in c#?

0 Answers  


Is type nullable c#?

0 Answers  


Does c# support properties of array types?

0 Answers  


Can the nested class access, the containing class. Give an example?

0 Answers  


what is generics? can u explain 5 to 6 examples on generics that covers class,method,structure,list,delegates?

0 Answers   Satyam,


Categories