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


Please Help Members By Posting Answers For Below Questions

Are string objects mutable or immutable?

526


What is virtual class in C#?

544


Is as keyword in c#?

515


What is datetime minvalue in c#?

569


What is difference between ienumerable and enumerable in c#?

473






How does foreach loop work in c#?

478


What are the applications of c#?

466


What is CASPOL?

604


What is the default value of decimal in c#?

487


Which are the loop types available in c#?

493


Between windows authentication and sql server authentication, which one is trusted and which one is untrusted?

482


What are Types of assemblies that can be created in dotnet

580


There were a lot of questions asked, so I will list the topic (and add a what is "topic" and know pros/cons). Extreme programming, what is a transaction, various SDLC design approaches, what is a namespace, define a good test case, what is a stored proc, webservice? design patterns? linker? compiler? access modifiers? stack vs. queue? arrays vs. linked lists? sorting algorithms? recursion? OOP principles?

1581


Define Abstract Class in C#

540


What are the extension methods in c#?

492