Home  >  Article  >  Backend Development  >  About access modifiers in php oop

About access modifiers in php oop

WBOY
WBOYOriginal
2016-07-25 09:03:501093browse
  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 ★ ★ ★



Statement:
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