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 |
Difference between string and stringbuilder?
What is strongly typed view?
Can a class have multiple constructors c#?
What is the default value of datetime in c#?
How do I get deterministic finalization in c#?
What is the difference between field and variable in c#?
What is a variable in c#?
what is a delegate? what it is used for?
13 Answers Choice Solutions, TCS,
what are the best design patterns for C#.Net?
why C++ Partial Object Oriented Programming Language and C# and Java Fully Object Oriented Language
11 Answers 3i Infotech, Alexa, Assyst, Naresh i Technologies, TCS,
What is a pre-requisite for connection pooling?
What is the difference between <c> and <code> xml documentation tag?
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)