Re: inheritance check too strict?
| From: | "Jean-Sébastien H." | Date: | Fri, 20 Aug 2010 10:54:14 +0000 |
| Subject: | Re: inheritance check too strict? | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49473@lists.php.net to get a copy of this message | ||
No it's wrong.
A Child is a Parent so we must be able to pass a Parent to the method
equals() defined on Child.
The declaration of the parent functions must always be valid in the
children.
On Thu, 19 Aug 2010 23:16:41 +0100, Nathan Rixham <nrixham@gmail.com>
wrote:
> lol, got it - confused myself for a bit there! yes agreed..
>
> incorrect:
> class Parent { function equals(Parent $o) {} }
> class Child extends Parent { function equals(Child $o) {} }
>
> correct:
> class Parent { function equals(Child $o) {} }
> class Child extends Parent { function equals(Parent $o) {} }
>
> sorry about the noise,
>
> nathan
--
Jean-Sébastien H.
au-fil-du.net