Re: RfC: rethink OO inheritance strictness
| From: | Ron Korving | Date: | Fri, 21 Jul 2006 11:32:12 +0000 |
| Subject: | Re: RfC: rethink OO inheritance strictness | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-24823@lists.php.net to get a copy of this message | ||
Isn't that why we have interfaces and abstract functions?
(I realize that that would remove the possibility to define a fallback
function in the parent class though.)
- Ron
""Soenke Ruempler"" <ruempler@topconcepts.com> schreef in bericht
news:EDB0F034E395BF4284D66D1FD59EBFDD668D60@sky.stade.topconcepts.net...
> Richard Quadling <mailto:rquadling@googlemail.com> wrote
> on Friday, July
> 21, 2006 12:28 PM:
>
>> Shouldn't be necessary. As there are 2 different methods, they should
>> be allowed different parameter signatures. If you want to extend a
>> method but hide original implementation, you can't change the
>> parameter signature. I'm on the opposite side of the fence to you it
>> seems!
>
> But that's not the nature of polymorphism and the predictness and
> consistency of an API. For example - think of object aggregation:
>
> public function setBlub(A $a) {
> $this->_a = $a;
> }
>
> Now because of my consistent API of class A and all derived classes I
> exactly know the methods and parameters, even if B (as child class of A)
> is passed to "setBlub()".
>
> So maybe from your POV it's two different methods (and yes, it IS
> *technically*). But from OOP and API design view it is polymorphism and
> consistency, if I didn't failed all OOP lessons and design pattern books
> ;)
>
> -soenke
>