Re: public and private parts in classes ?
| From: | Andrey Hristov | Date: | Tue, 25 Sep 2001 13:53:11 +0000 |
| Subject: | Re: public and private parts in classes ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-68703@lists.php.net to get a copy of this message | ||
Hmmm,
Original: $_this->foo = "bar";
I think that it must be:
$this->_foo = "bar";
Have fun.
Andrey Hristov
IcyGEN Corporation
http://www.icygen.com
BALANCED SOLUTIONS
----- Original Message -----
From: "Nick Winfield" <pioneer@dac.org>
To: <php-general@lists.php.net>
Sent: Tuesday, September 25, 2001 4:49 PM
Subject: Re: [PHP] public and private parts in classes ?
> On Tue, 25 Sep 2001, Andrey Hristov wrote:
>
> > > I'm sorry, if this is a faq. But I would like to know, if there exist
> > > public and private parts in classes like in c++ ?
> > >
> > > AFAIK there are no public and private parts supportet.
> > >
> > > I would be pleased to get either a confirmation on that or, if it works,
> > > some information on how to do it.
> > >
>
> > PHP Classes are not so powerful as C++. No there is no division ot
> > private and public or protected. All is public but good technique
> > is to name methods you prefer to be private with a underbar at the start.
>
> The same applies to properties:
>
> class Test {
>
> function Test() {
> $_this->foo = "bar";
> }
>
> }
>
> $n = new Test;
> echo "foo: " . $n->foo;
> // returns 'foo: '
>
> Cheers,
>
> Nick W..
> -[ pioneer@dac.org ]-
>
> :: today's word is..
>
> haggis (n): a small, hairy creature that has 8 long legs, looks like a set
> of bagpipes and tastes good with deep-fried chipped potatoes
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>