note 34837 deleted from keyword.parent by didou

From: Date: Fri, 08 Aug 2003 08:36:50 +0000
Subject: note 34837 deleted from keyword.parent by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-53629@lists.php.net to get a copy of this message
Note Submitter: sibaz at sibaz.com ---- 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.

« previous php.notes (#53629) next »