Home >Backend Development >PHP Tutorial >Detailed explanation of PHP's public_protected_private permission control

Detailed explanation of PHP's public_protected_private permission control

不言
不言Original
2018-04-26 11:03:551324browse

This article introduces a detailed explanation of PHP's public_protected_private permission control. It has a certain reference value. Now I share it with everyone. Friends in need can refer to it

// Compare private, protected, public The difference between the three

/*
private protected public
In this class Y Y
Inside subclass N Y :
public can be called outside the class, and the permissions are the loosest.
protected and private cannot be called outside the class

protected can be accessed within the subclass

public and protected can be accessed within this class
*/

Related recommendations:


privata permission control of PHP

The above is the detailed content of Detailed explanation of PHP's public_protected_private permission control. For more information, please follow other related articles on the PHP Chinese website!

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