This article mainly introduces the usage of php abstract classes, and analyzes the concept, definition, and implementation methods of abstract classes in php in the form of examples. For more information, see
This article mainly introduces the usage of php abstract classes, and analyzes the concept, definition, and implementation methods of abstract classes in php in the form of examples. For more information, see
This example describes the usage of php abstract classes. Share it with you for your reference. The details are as follows:
<? Php/** abstract * abstract class: * 1. There must be at least one abstract method (no specific implementation method) * 2. It cannot be instantiated, it can be inherited * 3. abstract classes can have subabstract Classes * compared with Interfaces: * 1. Attributes * 2. A subclass can only inherit one abstract class, however, you can implement multiple interfaces ***/abstract class qian {abstract function getfirst (); function gettwo () {echo "I am gettwo ";}} abstract class jj extends qian {abstract function getthree ();} class nan extends jj {function getfirst () {echo "I am getfirst";} function getthree () {echo "I am get Three ";}}$ nn = new nan (); $ nn-> getfirst (); $ nn-> gettwo (); $ nn-> getthree ();?>
I hope this article will help you with php programming.
,