note 34837 added to keyword.parent

From: Date: Fri, 08 Aug 2003 04:20:36 +0000
Subject: note 34837 added to keyword.parent
Groups: php.notes 
Request: Send a blank email to php-notes+get-53607@lists.php.net to get a copy of this message
if C# is like C++, then you've misunderstood the use of public/private variables. Everything in PHP is public, so a variable defined and used in a parent class is changed and reused by a child class. Private variables in a parent class are only avaliable to functions in that parent class. Any 'redeclaration' of variables with the same name in child classes is completely bogus. In PHP a::a and b::a are the same variable and so when a::display uses it, it gets the latest value (ie 9). in C++ (I'm assuming its the same as C# in this case), because a::a is private, b::a is a new separate variable. a::display doesn't know b::a exists, so rightly ignores it. ---- Manual Page -- http://www.php.net/manual/en/keyword.parent.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34837 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34837&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34837&report=yes

« previous php.notes (#53607) next »