How the PHP subclass accesses the static method of the parent class

Source: Internet
Author: User

1. Subclass internal access to the parent class static member property or method, using Parent::method ()/self::method ()
Note: $this->staticproperty (the static property of the parent class cannot be accessed through $this (subclass instance), there will be an error: PHP Strict standards:accessing static Properties person :: $country as non static in,php notice:undefined property:)
2. Sub-class external
1. Subclass Name:: Method ()
2. Subclass Instance->method () (static methods can also be accessed by ordinary objects)
Note: The subclass instance->staticproperty (the static property of the parent class cannot be accessed through the subclass instance, there is an error: PHP Strict standards:accessing static Properties person::$ Country as non static in,php notice:undefined property:)

How the PHP subclass accesses the static method of the parent class

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.