Re: Beginner Tutorials for using CLASSES in PHP4
| From: | Tony Marston | Date: | Wed, 10 Oct 2007 19:28:04 +0000 |
| Subject: | Re: Beginner Tutorials for using CLASSES in PHP4 | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263063@lists.php.net to get a copy of this message | ||
""Nathan Nobbe"" <quickshiftin@gmail.com> wrote in message
news:7dd2dc0b0710101150n7d0696a9j5e8755080f7b0cae@mail.gmail.com...
> On 10/10/07, Tony Marston <tony@marston-home.demon.co.uk> wrote:
>>
>>
>> ""Jay Blanchard"" <jblanchard@pocket.com> wrote in message
>>
>> news:56608562F6D5D948B22F5615E3F57E690357FCB7@YGEX01WAL.onecall.local...
>> [snip]
>> >> so what are the benefits of the "with interfaces" solution over
>> >>the"without interfaces" solution
>> [/snip]
>>
>> > Polymorphism.
>>
>> Are you saying that it is not possible to have polymorphism without using
>> interfaces? If so you are very much mistaken.
>>
>
> no, but what you still havent been able to grasp is the alternate
> polymorphic facility that interfaces offer.
But I don't need an alternative facility for polymorphism as the one I have
without interfaces is more than sufficient for my needs.
> how would you do the lawnmower w/o interfaces?
I wouldn't play with a lawnmower class in the first place. I use PHP to
write web applications which deal with database tables, not lawnmowers, and
I have yet to find a good reason for using interfaces in such applications.
Your contrived examples do not convince me of anything.
--
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
> use arrays instead, for grass and human hand,
> then you loose polymorphism.
> if you instead make human hand and grass extend from a common base class
> then youre combining the
> passing the behavior of some strange parent class to two mostly unrelated
> children.
>
> -nathan
>