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 array and its types in c#?

0 Answers  


What is the difference between early binding and late binding in c#?

0 Answers  


C# provides a default constructor for me. I write a constructor that takes a string as a parameter, but want to keep the no parameter one. How many constructors should I write?

3 Answers   Visual Soft,


What is the difference between internal and private in c#?

0 Answers  


What is AutoMapper in C#?

0 Answers   Infosys,






Which type of variables are under the control of garbage collector?

4 Answers   Kanbay,


What is the use of console readkey in c#?

0 Answers  


The int maps to which C# keyword in .NET type?

0 Answers   Siebel,


What is eager and lazy loading in c#?

0 Answers  


If a class is having 4 variables namely type double,type integer,type string,type decimal. If we create an instance of that class those variables which gets into this instance are value types or reference types?

4 Answers   Kanbay,


What will be the output of the following code?

0 Answers  


What connections does Microsoft SQL Server support?

3 Answers  


Categories