开发者

Explain what deriving an interface means?

开发者 https://www.devze.com 2023-02-15 16:03 出处:网络
Can someone please explain what deriving an interface means.开发者_如何学GoDeriving an interface means one interface extends another interface.

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消