1
Answer

Interface

Baba M

Baba M

16y
3.7k
1

C# does not support multiple inheritance. By using interface we can achieve multiple inheritance. How is it possible? To create interface interface key word is we are using, By the name of interface simply we can make use of it.

 

interface interface1

{

// some code here

}

interface interface2

{

//some code here

}

//Here class that uses the interface using this interfaces the multiple inheritance is achieved.

 

class class1 : interface1, interface2

{

//Here some code..

}

class class2

{

public static void main(String args[])

{

class1 c= new class1();

c.method1();

c.method2();

}

}

Answers (1)