Interface inheritance
In this chapter you will learn:
Interfaces Inheriting Interfaces
One interface can inherit another. The syntax is the same as for inheriting classes.
using System;/*from ja v a2 s. c om*/
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:
Home » C# Tutorial » Class