Re: How to force a variable to be a custom object?
| From: | Alex Gemmell | Date: | Fri, 02 Sep 2005 13:05:39 +0000 |
| Subject: | Re: How to force a variable to be a custom object? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-221756@lists.php.net to get a copy of this message | ||
Norbert Wenzel wrote:
I don't know if this works in PHP4, but I would suggest to clear this in your constructur. But I don't know if this is always called in PHP4. class myClass {I think PHP5 deals with private/public variables and all that gaff. PHP4 doesn't quite offer OO that well, but good enough if you strictly use your Class message interfaces! Thanks for the help Norbert. You're right - that would pretty much do the trick. Alexvar $object;myClass() { $this->object = new OtherObject();}} This isn't really forced, since you could change $object from outside the class. If there is a way you should declare $object private. That's not stylish, but I guess it works.