How to extend interface by inheitance in C#
Interfaces Inheriting Interfaces
One interface can inherit another. The syntax is the same as for inheriting classes.
using System;/* w w w . ja va 2 s . co m*/
interface Printable{
void print();
}
interface Displayable:Printable{
void output();
}
class MyClass : Displayable{
public void print(){
Console.WriteLine("print");
}
public void output(){
Console.WriteLine("output");
}
}
class Test
{
static void Main()
{
Displayable cls = new MyClass();
cls.print();
cls.output();
}
}
The output: