Re: [PHP4BETA] how to access objects parent?
| From: | waldschrott | Date: | Wed, 10 May 2000 12:37:10 +0000 |
| Subject: | Re: [PHP4BETA] how to access objects parent? | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-14738@lists.php.net to get a copy of this message | ||
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 ° · ° . ¤ ·