Re: OOP -- passing messages between objects
| From: | Matthew Weier O'Phinney | Date: | Tue, 12 Oct 2004 03:11:10 +0000 |
| Subject: | Re: OOP -- passing messages between objects | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199244@lists.php.net to get a copy of this message | ||
* Sandy Keathley <sandy@keathleywebs.com>:
> 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@garden.org
Webmaster and IT Specialist | http://www.garden.org
National Gardening Association | http://www.kidsgardening.com
802-863-5251 x156 | http://nationalgardenmonth.org