Re: [CFV] how to mark protected items?

From: Date: Tue, 22 Jun 2004 19:37:18 +0000
Subject: Re: [CFV] how to mark protected items?
References: 1 2 3 4 5 6 7 8  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31104@lists.php.net to get a copy of this message
Hi Tomas: On Tue, Jun 22, 2004 at 08:20:53PM +0200, Tomas V.V.Cox wrote: > > Well, in CS there was no distiction, '_' was for private and protected. That's not what the coding standards say. They just talk about private. > Was thought for "protecting" the user not the developer :-) I agree. And that's exactly why protected should be underscored. Example... <?php // --- code written by PEAR developer --- class a { protected $y = "why\n"; } class b extends a { function z() { echo $this->y; } } // --- code written by end user --- $b = new b; $b->z(); $a = new a; echo $a->y; /* * OUTPUT * why * Fatal error: Cannot access private property a::$y ... */ ?> --Dan -- T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y data intensive web and database programming http://www.AnalysisAndSolutions.com/ 4015 7th Ave #4, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409

« previous php.pear.dev (#31104) next »