Home > php教程 > PHP开发 > How to overload parent class methods in PHP object-oriented subclasses

How to overload parent class methods in PHP object-oriented subclasses

WBOY
Release: 2016-08-04 08:57:11
Original
1088 people have browsed it

Because functions with the same name cannot exist in PHP, methods with the same name cannot be defined in the same class. The overloading mentioned here means that a method with the same name as the parent class can be defined in a subclass to override the method inherited from the parent class.


Overloading parent class methods in subclasses


<?php
class Person{
                                        
             public $name;
                                          
          public function
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template