Re: Making a object from one class available to all objects in the calling class
| From: | Christian Reiniger | Date: | Mon, 05 Feb 2001 15:04:41 +0000 |
| Subject: | Re: Making a object from one class available to all objects in the calling class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38245@lists.php.net to get a copy of this message | ||
On Monday 05 February 2001 15:52, Stephen Maher wrote:
> Hi,
>
> Can someone advise on the following.
>
> class class_y
> {
> function test() {
> return "test";
> }
> }
>
> class class_x
> {
> function x {
> $n = new $y;
> }
>
> function z {
> $n->test();
> }
> }
>
> I need the object of class_y available to the other objects of classx
> but I cant figure out how I do this. Any ideas?
class class_x
{
function x {
$this->n = new $y;
}
function z {
$this->n->test();
}
var n;
}
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka", but "That's funny..."
- Isaac Asimov