Re: question about compositing objects

From: Date: Fri, 13 Jan 2006 00:30:03 +0000
Subject: Re: question about compositing objects
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-228550@lists.php.net to get a copy of this message
$map is not a member variable of the Loc class in your code... Instead do this: class Loc { // Defines a member variable var $map; // Constructor function Loc() { $this->map = new Map(); // Create map object and save to Loc object $this->map->setKey(); } } $loc = new Loc(); $loc->map->publicMapFunction(); Aaron ---------------------------------------------------------- On 1/12/06, jonathan <news_php@arclocal.com> 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 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#228550) next »