Re: Inheritance/compatibility behavior
| From: | Sam Barrow | Date: | Tue, 29 Apr 2008 13:35:50 +0000 |
| Subject: | Re: Inheritance/compatibility behavior | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37293@lists.php.net to get a copy of this message | ||
On Tue, 2008-04-29 at 09:34 -0400, Sam Barrow wrote:
> I want to make two classes:
>
> abstract class a {
> abstract public function go($a);
> }
> final class b extends a {
> abstract public function go(array $a);
> }
>
Sorry, function in class b should not be abstract.
> This will not work, I get an error that the two must be compatible.
> Wouldn't it be a good idea to allow any type hint for a parameter that
> does not specify a type hint?
>
> Ie, I can do the above, but not the following:
>
> abstract class a {
> abstract public function go(myClass $a);
> }
> final class b extends a {
> abstract public function go(array $a);
> }
>
Same, function in class b should not be abstract.