RE: [PHP4BETA] how to access objects parent?
| From: | Stewart Taylor | Date: | Wed, 10 May 2000 14:46:30 +0000 |
| Subject: | RE: [PHP4BETA] how to access objects parent? | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-14751@lists.php.net to get a copy of this message | ||
Might you create an propery called super in parasite.
class parasite
{
var $super;
...
then use super as an alias of $bigmama
$bigmama->worm = new parsite();
$bigmama->worm->super = &$bigmama;
Regards,
Stewart.
-----Original Message-----
From: waldschrott [mailto:waldschrott@kiffen.de]
Sent: 10 May 2000 13:37
To: Dan; php4beta
Subject: Re: [PHP4BETA] how to access objects parent?
I´m not sure what you mean. I do not derive. I´m just creating a new
object into another object.
I think I´ve mis-chosen the class name "child" because actually "child"
and "mama" have nothing to do with each other.
Perhaps that would be better:
$bigmama = new mama();
$bigmama->bag='
$bigmama->equipment1 = new cake();
$bigmama->worm = new parasite();
$bigmama->worm->eat();
Bigmama´s worm is a parasite eating only eating equipment1´s, but how
can he?
class parasite {
function eat() {
$super->equipment1=''; } } // A kind of $super like in Java
would be
needed.
Can anyone explain if (and how) it is possible to realize this?
thx
"Dan" wrote:
> Use the name of the object you derive from. Since you must declare it in
the
> class anyway, it's not so awful.
>
> > -----Original Message-----
> > From: waldschrott [mailto:waldschrott@kiffen.de]
> > Sent: Tuesday, May 09, 2000 2:44 PM
> > To: php4beta
> > Subject: [PHP4BETA] how to access objects parent?
> >
> >
> > Hi,
> > I wonder how to access an objects parent in php? I think I´ve
> > found it
> > in the mail archives before, but I couldn´t find it again.
> > For example if I do...
> > $bigmama = new mama();
> > $bigmama->littlechild= new child();
> >
> > ...
> >
> > class child {
> > function where_is_my_mama() {
> > // how do I acces the parent object from here*
> > // I think $super won´t work
> > }}
> >
> > thx
> >
> >
> > --
> > PHP 4.0 Beta Mailing List
> > <http://www.php.net/version4/>
> > To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> > For additional commands, e-mail: php4beta-help@lists.php.net
> > To contact the list administrators, e-mail:
> > php4beta-admin@lists.php.net
> >
>
--
o----------0-¬---------O-·---¬----o---®-----o o O ° .
| http://www.kiffen.de | pRoteçt y0ur bRaín |0 O ° ¤
° ·
0°·³°²'²³-¹'³´³°^°³~³²³°'³²²¨³²^³¹³²°²³`³º³°Þ
° o © ° . ·
| psychedelic experience | gott@kiffen.de | O ° o °
o-¬--o--0-----©-·--O-----o-----0-¤----------o 0 ° · ° . ¤ ·
--
PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
For additional commands, e-mail: php4beta-help@lists.php.net
To contact the list administrators, e-mail: php4beta-admin@lists.php.net