Method/Function chaining?
| From: | Dan Ostrowski | Date: | Fri, 13 Aug 2004 22:59:44 +0000 |
| Subject: | Method/Function chaining? | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-12153@lists.php.net to get a copy of this message | ||
Hello.
Excuse my ignorance on this, but I can't seem to find the answer I'm
looking for online... Will PHP5 be able to do "chaining" as some other
languages are able to do?
In other words...
------------------------------
<?php
class A
{
function A() { print "made an A...<br>\n"; }
function getB() { return new B(); }
}
class B
{
function B() { print "made a B...<br>\n"; }
function shout() { print "hey!!"; }
}
$a = &new A();
$a->getB()->shout();
?>
----------------------------
This kind of polymorphism is something I'm used to, and I'm hoping it
won't result in a parse error in PHP5. =)
--
Dan Ostrowski