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
Explain hash table in c# ?
What is function c#?
How do I open the console?
What is difference between abstraction and encapsulation in c#?
What is int32?
How many types of constructors are there in c#?
Why c# is called c sharp?
What is type safe in c#?
What is the use of delegate?
What is difference between int and int in c#?
What does void do in unity?
What are reflections in c#?
Can we have static indexer in c#?
What is iqueryable and ienumerable in c#?
What is the differences between datagrid, datalist and repeater in .net?