: This article mainly introduces object-oriented PHP (V). If you are interested in the PHP Tutorial, refer to it.
";}}// Inherit the abstract class using extendsclassHumanextendsACanEat {// define the subclass of the abstract class. you need to define publicfunctioneat ($ food) {echo" Human eating "for the abstract method in the parent class ". $ food."
";}} ClassAnimalextendsACanEat {publicfunctioneat ($ food) {echo" Animal eating ". $ food ."
";}}$ Pzy = new Human (); $ dog = new Animal (); $ pzy-> eat (" meat "); $ dog-> eat ("bone"); $ pzy-> breath (); $ dog-> breath ();?>
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.
The above introduces the object-oriented PHP (V), including the content, hope to be helpful to friends who are interested in PHP tutorials.