1.6K
Like classes, interface can also be extended. An interface can be subinterfaced from other interface.The new subinterface will inherit all the members of the superinterface in the manner similar to subclasses.
syntax for extending interface
interface interfaceName2 extends interfaceName1
{
body of interfaceName2;
}
It is important to remember An interface cannot extend classes.This violate the rule that an interface can have only abstract methods and constants.
Now, Have a look on an example
interface A
{
int code=120;
string Name="Techarge";
}
interface B extends A
{
void enter();
}
interface C extends A,B
{
void display();
}