Re: Declaration of Bar::__construct() must be compatible with that of Foo::__construct()
| From: | Marcus Boerger | Date: | Wed, 25 Feb 2004 22:44:01 +0000 |
| Subject: | Re: Declaration of Bar::__construct() must be compatible with that of Foo::__construct() | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8129@lists.php.net to get a copy of this message | ||
Hello Timm,
i had the same expirience today too. And also for me it makes not much
sense. The constructor shouldn't check inheritance rules. And as a
consequence maybe interfaces shouldn't allow constructors.
marcus
Wednesday, February 25, 2004, 11:36:57 PM, you wrote:
> thekid@friebes:~/devel/php/tests > cat inheritance.php
> <?php
> class Foo {
> function __construct($foo) {
> }
> }
> class Bar extends Foo {
> function __construct($foo, $bar) {
> // Add = NULL after $bar to make it work
> }
> }
?>>
> thekid@friebes:~/devel/php/tests > php-dev inheritance.php
> Fatal error: Declaration of Bar::__construct() must be compatible with
> that of Foo::__construct() in
> /usr/home/thekid/devel/php/tests/inheritance.php on line 10
> Is this really necessary?
> - Timm
--
Best regards,
Marcus mailto:helly@php.net