Re: Calling parent's constructor
| From: | Kristian Köhntopp | Date: | Thu, 14 Dec 2000 13:46:26 +0000 |
| Subject: | Re: Calling parent's constructor | ||
| References: | 1 2 3 4 5 6 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-41358@lists.php.net to get a copy of this message | ||
Alan van den Bosch wrote:
> Just a thought - If the desired functionality _only_ applies to the parent
> class constructor why not just __parent(). On the other hand, this could be
> further extended to call any parent class function with
> __parent::some_func() and a call to the parent constructor looking like
> __parent::__parent().
We already have parent::some_func(). It is just that the
name of the constructor in the parent class is not a constant
like __init(), but dependent on the actual name of the
parent class. So you cannot call parent::__init(), but you
have to use a pseudo-name parent::__parent(), where PHP
resolves the __parent() part to the actual constructor
name.
Or you'd change constructors to have a constant name,
like, say, __init(), and keep some compatibility logic
to emulate the old behaviour.
Kristian
--
Kristian Köhntopp, NetUSE AG Siemenswall, D-24107 Kiel
Tel: +49 431 386 436 00, Fax: +49 431 386 435 99
Using PHP3? See our web development library at http://phplib.netuse.de/