What is the difference between private and protected members of a class? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 1

What is the difference between private and protected members of a class?

What is the difference between private and protected members of a class?

15th Feb 2018, 7:30 PM
Aleksandr
1 Réponse
+ 15
Members declared protected can be accessed only within the class itself and by inheriting and parent classes. Members declared as private may only be accessed by the class that defines the member. http://php.net/manual/en/language.oop5.visibility.php
15th Feb 2018, 7:41 PM
NezhnyjVampir