We can use the same syntax to extend the interface.
using System;
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:
print
output
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |