How do you create multiple inheritance in C#?
Answer Posted / 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 ? | 47 Yes | 19 No |
Post New Answer View All Answers
What the different phase/steps of acquiring a proxy object in webservice?
Can list contain duplicates c#?
Can constructor be protected?
How are methods overloaded?
What is a clr (common language runtime)?
Explain the difference between proc. Sent by val and by sub?
To allow an element to be accessed using a unique key which .NET collection class is used ?
Are constructors inherited c#?
What is eager loading in c#?
What is dll in c#?
How does one compare strings in c#?
What is an event in c#?
Describe the overview of clr integration.
What are the collections in c#?
What is the components of window?