总是使抽象父类实现一个接口。模板方法设计模式在框架设计中特别有价值(在这章的结尾讨论了)。
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.
我们可以实现在相同的抽象类,抽象的方法,但我们不能实现在同一接口的接口方法。
We can implement the abstract method in inside of the same abstract class, but we can't implement the interface method in inside of the same interface.
我们可以实现在相同的抽象类,抽象的方法,但我们不能实现在同一接口的接口方法。
We can implement the abstract method in inside of the same abstract class, but we can't implement the interface method in inside of the same interface.
应用推荐