|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-08-29 17:52 UTC] vrana@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sat Feb 07 07:00:01 2026 UTC |
Description: ------------ The first paragraph includes the following description of protected: "Protected limits access to inherited classes (and to the class that defines the item)." However it actually allows access from functions in both the parent and child classes. I've provided some example code. Reproduce code: --------------- <?php class aParent { function get_a () { echo $this->a; } } class aChild extends aParent { protected $a = "hi"; } $my_obj = new aChild(); $my_obj->get_a(); # Prints hi ?>