Class inheritance in PHP _php tutorial

Source: Internet
Author: User

Inheritance of classes in PHP


1, subclass inherits the parent class with the Extends keyword 2, the subclass can inherit from only one parent class, but the parent class inherits from another Class 3, inherits, can inherit the public/protected property and method of the parent class, cannot inherit the private property and Method 4, subclass, can declare the property and method with the same name as the parent class to overwrite, But inherited permissions can only be the same or more relaxed, not more stringent, such as the parent class declared protected $a, the subclass can not declare the private $a, can only be public or protected

http://www.bkjia.com/PHPjc/1071709.html www.bkjia.com true http://www.bkjia.com/PHPjc/1071709.html techarticle the class in PHP inherits 1, the subclass inherits the parent class with the Extends keyword 2, the subclass can inherit from only one parent class, but the parent class may inherit from another class 3, inherits, can inherit the parent class's public ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.