Re: Constant Classes
| From: | Zeev Suraski | Date: | Mon, 15 Apr 2002 09:20:31 +0000 |
| Subject: | Re: Constant Classes | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-82801@lists.php.net to get a copy of this message | ||
No, if you use the reference logic, than the fact that BaseBeer is defined to be a certain reference, is the meaning of it being constant. The contents of the object this reference points to may change. You just have to get used to the reference based logic.
That said, it doesn't make too much sense in my opinion to use constants to hold objects, but if you see use for it, that's the way it's going to work...
Zeev
At 03:52 15/04/2002, medvitz wrote:
Should it be the same object, though??? I thought that the whole concept of a 'constant' was that it, well, was constant. Wouldn't it make more sense to auto-clone objects when they are accessed through a constant???? Medvitz Zeev Suraski wrote: It'll be the same object. At 17:33 14/04/2002, medvitz wrote:-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.phpThis may have been addressed already but: If I have the following code: class Beer { ... } $a = new Beer(); define('BaseBeer', $a); $b = BaseBeer; Will $a & $b be the same object or will $b be a copy. (Under ZE2). Thx. Medvitz -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php