Multiple Inheritance
using System;
/* when a derived class is created from more than one base class then that inheritance is called as multiple inheritance.
* But multiple inheritance is not supported by .net using classes and can be done using interfaces. */
interface interface1
{
void display1();
}
interface interface2
{
void display2();
}
class MyClass : interface1, interface2 // Now MyClass should implement all the methods in both the interfaces.
{
public void display1()
{
Console.WriteLine("Inside display 1");
}
public void display2()
{
Console.WriteLine("Inside display 2");
}
static void Main(string[] args)
{
MyClass myclass = new MyClass();
myclass.display1();
myclass.display2();
Console.ReadLine();
}
}
Output:
Inside display 1
Inside display 2