Re: Accessing objects of other objects?

From: Date: Fri, 29 Aug 2003 15:50:21 +0000
Subject: Re: Accessing objects of other objects?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-161147@lists.php.net to get a copy of this message
On Fri, 29 Aug 2003 15:19:23 +0200, you wrote: >On page "A" of my homepage I create an object "1" which itself creates an >object "2". >Now how can I access the properties of object "2" from "A" ? Two approaches. C contains an instance of A or E extends A. <? class A { function B ($s = "None") { echo ("<p>input : $s</p>"); } } class C { var $instance_of_A; function C () { $this->instance_of_A = new A(); } function D () { $this->instance_of_A->B("Hello World"); } } class E extends A { function F () { $this->B ("Hello World"); } } $x = new C(); $x->D(); $x = new E(); $x->F(); ?>

« previous php.general (#161147) next »