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 are the different types of assembly?
What is a factory in c#?
What is xor operator in c#?
What is data quality assurance?
How do you serialize in c#?
What is an escape sequence? Name some string escape sequences in c#.
What is cache memory in c#?
How Reflection is used and what it's significance ?
What are primitive data types in c#?
What are collections in c#?
Which is faster iqueryable or ienumerable?
What is iqueryable in c#?
what are nullable types in c#
Is null == null c#?
What is querystring in c#?