Explain what deriving an interface means?
Can someone please explain what deriving an interface means.开发者_如何学Go
Deriving an interface means one interface extends another interface.
interface A {
public void foo();
}
interface B extends A {
public void bar();
}
class C implements B {
@Override
public void foo() {
// implement this
}
@Override
public void bar() {
// implement this
}
}
I haven't heard the word "deriving" used for an interface before. I think what you mean is "implementing" an interface.
Implementing an interface is creating a class that declares that it "implements" that interface and has all the methods that are declared in that interface (but if it is an abstract class, all methods might not be present).
精彩评论