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 |
Why can’t struct be used instead of class for storing entity?
What the different phase/steps of acquiring a proxy object in webservice?
What you mean by inner exception in c#?
Why do we need constructors?
What are the types of serialization?
What is the signature of a method?
What is the difference between method parameters and method arguments. Give an example?
What operator means?
Name some properties of array.
Why do we use static methods in c#?
why C#.net doesnot support prcedures and why it supports structs,functions
What is the wildcard character in SQL? Let?s say you want to query database with LIKE for all employees whose name starts with La.
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)