Re: Inheritance/compatibility behavior
| From: | Sam Barrow | Date: | Tue, 29 Apr 2008 15:41:55 +0000 |
| Subject: | Re: Inheritance/compatibility behavior | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-37301@lists.php.net to get a copy of this message | ||
On Tue, 2008-04-29 at 17:43 +0200, Stefan Walk wrote:
> On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote:
>
> > 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?
>
> That would be a bad idea, because it violates a (in my opinion, the) core
> principle of OO: If B inherits from A, anything I can do with A (i.e. pass an
> int to the method go) I can do with B.
> http://en.wikipedia.org/wiki/Liskov_substitution_principle
Yes this was my only doubt about it.
> Regards,
> Stefan
>
> P.S. Sorry if this pops up twice, used the wrong from: address at first ...
>