Re: Class and subclass
| From: | Stut | Date: | Wed, 07 Mar 2007 15:12:18 +0000 |
| Subject: | Re: Class and subclass | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-249987@lists.php.net to get a copy of this message | ||
Alain Roger wrote:
i have a class A with some properties. i have a class B with several public functions (i.e : Render()) i would like to do something like that : class B() { B() { } public function Render() { ... } } class A { private $myotherclass; A() { $this->myotherclass = new classB(); } public function test() { $this->myotherclass->Render(); } } however, i'm not able to access to ->Render() of class B from Class A property. Where could be the problem ?That code is not valid for a number of reasons. What you're trying to do is done like so... http://dev.stut.net/php/ab.php I suggest you read up on classes and the syntax thereof in the manual - you're not getting it at the moment. Remember, PHP is not C++. -Stut