Re: question about compositing objects

From: Date: Fri, 13 Jan 2006 00:35:35 +0000
Subject: Re: question about compositing objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228547@lists.php.net to get a copy of this message
jonathan wrote: > I have a class which creates another class within it such as: > > class Loc{ > > public function outputInfo() > { > > > $map=new Map(); > > $map->setKey(); > > > } > > } > > In my main page can I access the $map object like this: > > $loc=new Loc(); > > $loc->map->publicMapFunction(); > > I thought I would be able to but it doesn't seem like it. > > thanks in advance. > > -jonathan Try this: class Loc { public var $map; function oputputInfo() { $this->map = new Map(); } }; $loc = new Loc(); $lock->outputInfo(); $loc->map->publicMapFunction();

« previous php.general (#228547) next »