Re: question about compositing objects

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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();

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux