Re: Fwd: Re: [PHP] Private and protected variables in PHP 5?

From: Date: Sat, 12 Jul 2003 18:30:58 +0000
Subject: Re: Fwd: Re: [PHP] Private and protected variables in PHP 5?
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-3392@lists.php.net to get a copy of this message
At 05:38 PM 12/7/2003 +0100, Paul Hudson wrote:
Andi, However, if you inherit from this class the new class does not know any of the parents' private members and therefore doesn't error out. This is the correct way of handling it because private members should be hidden to inheriting classes. When you say "hidden", do you mean that it still exists? That is, in the code example there's a private $Name for the dog class, and I set a new $Name in the code. Would that mean there was a private $Name and a public $Name? If so, I imagine that all functions that had access to the private $Name would use it, and all functions that didn't have access would use the public $Name. Sounds kinda confusing! Is this correct?
Yeah that's correct. The private needs to *stick* around because the class where it is defined needs to have access to it. Andi

« previous php.internals (#3392) next »