# inheritance check too strict?

- Thread: https://externals.io/message/49474
- Original archive: https://news-web.php.net/php.internals/49474
- Started by nrixham@gmail.com on 2010-08-20T11:39:29+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #49474 — nrixham@gmail.com — 2010-08-20T11:39:29+00:00

URL: https://externals.io/message/49474#49474

You can.. 
------Original Message------
From: "Jean-Sébastien H."
To: nrixham@gmail.com
Cc: postmaster@colder.ch
Cc: internals@lists.php.net
Subject: Re: [PHP-DEV] inheritance check too strict?
Sent: 20 Aug 2010 11:54

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


Sent using BlackBerry® from Orange
