Re: Zend 2 const class members private?
| From: | Stig S. Bakken | Date: | Fri, 14 Jun 2002 23:47:34 +0000 |
| Subject: | Re: Zend 2 const class members private? | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-85226@lists.php.net to get a copy of this message | ||
On Mon, 2002-06-10 at 22:37, Leendert Brouwer wrote:
> I have just started experimenting with the Zend 2 engine, and totally love
> the new OO features. I'm not sure whether this has been discussed or not (I
> couldn't find it in the archives, anyway), but I ran into a few things:
> Constant class members seem to be private by default. I cannot access them
> by doing
> $instance->CONSTNAME
> Is this expected behaviour? I'd expect constants to be public by default,
> just like regular variables, unless specified otherwise (when I try doing:
> private const FOO = "bar"; I get a parse error). Same for private static.
> Is this all going to change? It seems a bit illogical now.
> Thanks
Constants belong to the class, not the instance. Try Class::CONSTNAME
instead.
- Stig
--
Stig Sæther Bakken, Fast Search & Transfer ASA, Trondheim, Norway
http://pear.php.net/wishlist.php/ssb