C# Interface inheritance
Interfaces Inheriting Interfaces
One interface can inherit another. The syntax is the same as for inheriting classes.
using System;/*from www . ja v a2s. c o 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:
Next chapter...
What you will learn in the next chapter: