using returned references directly?
| From: | Jeff Schmidt | Date: | Mon, 17 May 2004 21:25:57 +0000 |
| Subject: | using returned references directly? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-186436@lists.php.net to get a copy of this message | ||
Hello,
Say I have object A, with method getObjectB(), which returns a reference to object2.
Is there a way to do something like $A->getObjectB()->methodFromObjectB();
??
When I try that, I get a parse error? Is this simply not possible with PHP, or is the syntax just a little different?
I mean, I could:
$b = $A->getObjectB();
$b->methodFromObjectB();
But since I only want to use object B once, it seems like a waste to store it and then use it. I do this kind of thing in other OO languages quite frequently.
Jeff Schmidt
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc