PHP Manual
后退 | 章 19. 类与对象(PHP 5) | 前进

# 抽象类

PHP 5 中引入了抽象类及方法的概念。 An abstract method only declares the method's signature and does not provide an implementation. A class that contains abstract methods needs to be declared abstract.

例子 19-6. 抽象类代码实例
`<?php abstract class AbstractClass { abstract public function test(); } class ImplementedClass extends AbstractClass { public function test() { echo "ImplementedClass::test() called.\n"; } } $o = new ImplementedClass; $o->test(); ?>`

抽象类不能被实例化。Old code that has no user-defined classes or functions named 'abstract' should run without modifications.

后退 | 起点 | 前进
Object Constants | 上一级 | Object Interfaces