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 ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is the default modifier for class in c#?
What is _viewstart cshtml?
What is the extension of c# file?
What do you mean by directing?
What are PE(Portable Executable)?
What are assemblies?
What are cookies in c#?
What is console readkey ()?
Why does my windows application pop up a console window every time I run it?
What is Custom attribute? How to create? If I'm having custom attribute in an assembly, how to say that name in the code?
What is difference between web and window application?
what is c# command?
What is xpath in c#?
Is javascript harder than c#?
What is the purpose of constructor in c#?