... 接口继承(Interface inheritance): 类实现抽象接口的方法,保留既定语义(intended semantics) 例如:question.askTheUser(); ...
基于1个网页-相关网页
总是使抽象父类实现一个接口。模板方法设计模式在框架设计中特别有价值(在这章的结尾讨论了)。
Always make the abstract parent class implement an interface. The Template Method design pattern is especially valuable in framework design (discussed towards the end of this chapter).
一个类,它要么实现接口中描述的所有方法(然后这就是常见类),要么这个类实现接口中的一部分方法,然后这个类被标记成抽象类。
A class that implements an interface must implement all of the methods described in the interface, or be an abstract class.
必须实现每个接口中声明的所有方法,或者声明您的实现类抽象。
You must implement all methods declared in each interface or declare your implementing class abstract.
应用推荐