Access modifiers in php oop

Source: Internet
Author: User
Tags php oop
Access modifiers in php oop

  1. /*
  2. The following two methods declare that the access permission works the same
  3. */
  4. Function say (){};
  5. Publilc function say (){};

When a class member is declared as a public access modifier, the member can be accessed and operated by external code. Private (private) is defined as a private member. it is visible to all members in the class and has no access restrictions. Access to the outside of the class is not allowed. Protected (protected) protected is a little complicated. it is declared as a member of protected and can only be accessed by subclass of this class.

Access permission list: access permission public protected private all★Subclass★★Class★★★

Related Article

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.