Re: Class::__construct() vs. $this->__construct()
| From: | Martin Jansen | Date: | Thu, 31 Mar 2005 12:04:53 +0000 |
| Subject: | Re: Class::__construct() vs. $this->__construct() | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-37023@lists.php.net to get a copy of this message | ||
On Wed Mar 30, 2005 at 02:0739PM -0800, Ian Eure wrote:
> I'm not sure about the parent::__construct() use. Does anyone know if this a
> special case which allows use of $this, unlike other static calls?
That's correct.
<?php
class A {
function __construct() {
$this->foo = "bar";
}
}
class B extends A {
function __construct() {
parent::__construct();
echo $this->foo . "\n";
}
}
$obj = new B;
- Martin