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 command object in c#?
How long does it take to get a loop recorder put in?
Define an abstract class?
What are data types examples?
What is the usage of transponders?
Give an example of a directcast.
What are the Types of caching
List down the commonly used types of exceptions in .net
Is there a way of specifying which block or loop to break out of when working with nested loops?
Is array thread safe c#?
What is difference between event and delegate in c#?
What does out mean in c#?
what is object-oriented programming (oop) language?
What is a multicast delegate in c#?
What can you do as a .net developer?