更新时间:2023-01-18 13:51:02
抽象类是至少包含一个抽象方法的类,是一种没有任何实际代码,只有名称和参数的方法,并且已标记为抽象".
An abstract class is a class that contains at least one abstract method, which is a method without any actual code in it, just the name and the parameters, and that has been marked as "abstract".
这样做的目的是提供一种模板来继承并强制继承类实现抽象方法.
The purpose of this is to provide a kind of template to inherit from and to force the inheriting class to implement the abstract methods.
因此,抽象类介于常规类和纯接口之间.接口也是抽象类的特例,其中所有方法都是抽象的.
An abstract class thus is something between a regular class and a pure interface. Also interfaces are a special case of abstract classes where ALL methods are abstract.
请参阅 PHP 手册的本部分以获取进一步参考.
See this section of the PHP manual for further reference.