从PHP V 4迁移到PHP v5时要利用的下一个重要特性是支持通过接口、抽象类和方法进行契约编程。
The next important feature to take advantage of when migrating from PHP V4 to V5 is support for contract programming through interfaces and abstract classes and methods.
Authenticator是一个抽象类,所以需要从它派生出子类,并实现 getPasswordAuthentication()方法来存储用户名和密码(见清单13)。
The Authenticator class is abstract, so you'll need to subclass it and implement the getPasswordAuthentication() method to store the username and password (see Listing 13).
我们不能实例化一个抽象类,即使它们的字段和方法都是具体的。
We can't instantiate instances of abstract classes, even when all their field and method members are concrete.
可以在抽象类中声明标准和抽象方法,如清单5所示。
You can declare standard and abstract methods in an abstract class, as shown in Listing 5.
注意,抽象类和抽象方法用斜体表示。
Notice that an abstract class is denoted by italicized text, as are abstract methods.
实现标准的面向对象功能,比如:私有构造函数、抽象方法和抽象类等。
Implement standard OOP features like private constructors, abstract methods and classes.
如果您不熟悉主题,那么抽象类MetalTheme提供了一个抽象外观使用的颜色和字体的方法。
For those unfamiliar with themes, the abstract MetalTheme class offers a way to abstract away the colors and fonts used by the look and feel.
模板方法模式和抽象类的不同在与处理工作流程。
This differs from the Template Method pattern in that the abstract superclass doesn't handle workflow.
可以重写方法、重命名标识符、重构参数,以及实现接口和抽象类。
You can override methods, rename identifiers, refactor parameters, and implement interfaces and abstract classes.
你可以看到抽象类和抽象方法作为一种合同。
You can see abstract classes and abstract methods as a sort of contract.
抽象类可以有抽象和非抽象方法。
An abstract class can have both abstract and non abstract methods.
抽象类可以有抽象和非抽象方法。
An abstract class can have both abstract and non abstract methods.
应用推荐