How do you create multiple inheritance in C#?
Answers were Sorted based on User's Feedback
Answer / p.senthil
C# doesnt support multiple inheritance. So using interfaces
to solve that problem
| Is This Answer Correct ? | 5 Yes | 0 No |
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 |
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 |
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 |
Explain manifest & metadata in c#.
Explain the working of serialization?
What does writeline mean?
What is the best dependency injection c#?
What is Serialization and how do we implement (in real time scenario)
What is a strong name in c#?
Does c# support a variable number of arguments?
Why do we use dataset in c#?
What is the full form of GAC? Explain its uses?
How to parse a date time string?
How do you encapsulate in c#?
What is a decimal in c#?
Visual Basic (800)
C Sharp (3816)
ASP.NET (3180)
VB.NET (461)
COM+ (79)
ADO.NET (717)
IIS (369)
MTS (11)
Crystal Reports (81)
BizTalk (89)
Dot Net (2435)
Exchange Server (362)
SharePoint (720)
WCF (340)
MS Office Microsoft (6963)
LINQ Language-Integrated Query (317)
WPF (371)
TypeScript (144)
Microsoft Related AllOther (311)