About access modifiers in php oop

WBOY
Release: 2016-07-25 09:03:50
Original
1112 people have browsed it
  1. /*
  2. The following two methods have the same effect of declaring access permissions
  3. */
  4. function say(){};
  5. publilc function say(){};
Copy code

When a member of a class is When declared as a public access modifier, the member can be accessed and manipulated by external code. private Members defined as private are visible to all members within the class and have no access restrictions. Access is not allowed outside the class. protected Protected is a little more complicated. Members declared as protected only allow access by subclasses of the class.

Access permission table: access rights public protected private All ★ Subcategories ★ ★ Within category ★ ★ ★



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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template