Re: Declaration of Bar::__construct() must be compatible
| From: | Hans Lellelid | Date: | Wed, 25 Feb 2004 23:54:08 +0000 |
| Subject: | Re: Declaration of Bar::__construct() must be compatible | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-8133@lists.php.net to get a copy of this message | ||
Timm Friebe wrote:
On Wed, 2004-02-25 at 23:44, Marcus Boerger wrote:Yes, I think this is the same issue that I brought up earlier related to interfaces. I brought it up then as an inconsistency -- i.e. that you couldn't override methods in interfaces & hence using interfaces was limiting the OO inheritance that PHP supported when not using interfaces. In brief the issue was that if you extend a class that implemented an interface the extending class (subclass) had to also implement the parent class' interface and was therefore not allowed to override methods (w/ incompatible signatures) -- and not allowed to implement a different interface which itself might specify incompatible signatures. It seems now that PHP is no longer inconsistent, but it also seems that it is impossible to override methods w/ incompatible signature. Is that a correct assessment? This is a pretty big difference from PHP4, then. Personally, I can live with it :) -- just want to make sure I understand it correctly. Thanks, HansHello Timm, i had the same expirience today too. And also for me it makes not much sense. The constructor shouldn't check inheritance rules.Neither should other methods follow this. What if I want to add a non-default parameter to an overriden method?