Re: OOP -- passing messages between objects

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

 



* Sandy Keathley <sandy@xxxxxxxxxxxxxxxx>:
> Can someone tell me the proper syntax for accessing a method in 
> one class from another class?
>
> I used this, where $obj and $page are instantiated objects:
>
> (From the $page class)
>
> obj::getData($id);

if $obj is instantiated, you'd call it like any other method:
$obj->getData($id);

if 'obj' is the NAME of a class, and getData is the name of a STATIC
METHOD, obj::getData($id) would work fine. If 'obj' is a PROPERTY of the
page class that happens to be an object, $page->obj->getData($id) would
likely work.

> It worked in an application on one server, failed in another 
> application on another server.

Please give some more details of your code -- the context in which the
call is being made would be helpful.

-- 
Matthew Weier O'Phinney           | mailto:matthew@xxxxxxxxxx
Webmaster and IT Specialist       | http://www.garden.org
National Gardening Association    | http://www.kidsgardening.com
802-863-5251 x156                 | http://nationalgardenmonth.org

-- 
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