Re: Scoping functions in PHP
| From: | Lee Doolan | Date: | Thu, 11 Apr 2002 19:30:04 +0000 |
| Subject: | Re: Scoping functions in PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92646@lists.php.net to get a copy of this message | ||
>>>>> "Eric" == Eric Starr <webmaster@lifechangers.org> writes:
Eric> I am a Java programmer learning PHP. In Java you can have a
Eric> class that contains public and private functions. Only the
Eric> public functions are accessible outside of the class. Does
Eric> PHP have a way to hide functions within a class (i.e. make
Eric> the private)?
Well, one thing which you could do is to use the scout's honor
protocol: define all of your private methods or protected methods
according to some naming convention, say, beginning with 'p' followed
by two underbars (p__) for private methods.
Then, use an 'honor lock'; only call such functions from authorized
locii such as own classes for private methods or derived classes
for protected functions and so forth...
-l
--
Share your feedback at Affero:
http://svcs.affero.net/rm.php?r=leed_25