Make full useAbstract classRules must be kept in mind.
- A ClassInclude at least one abstract MethodIt must be declared as an abstract class.
- An abstract method must includeSame or lower access level. For example, if the access level of a method in an abstract class is protected, it must be protected or public in the inherited class, rather than private.
- The New Keyword cannot be used.Create an instance of an abstract class.
- Methods declared as abstractFunction body cannot be included.
- If you declare an extended class as an abstract class, you canIn order not to implement all abstract methods.
use abstract modifier can declare a class as abstract.
abstract classes have some limitations. Php only one base class can be inherited. , it does not support inheritance from two or more abstract classes. The ability to inherit from two or more foundation classes is generally referred to as multi-inheritance , PHP is designed to disable this function. The reason is that when two or more classes define the same prototype and have a complete implementation method, inheritance from multiple classes will lead to unnecessary complexity. If you find that you need to inherit from two or more abstract classes, you can disassemble the methods of the base class , and then use interfaces to achieve the same purpose.