Polymorphism [was] [Fwd: Re: [PHP] Parents constructor]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-------- Original Message --------

On Fri, 2006-03-24 at 10:50, Jochem Maas wrote:
Pham Huu Le Quoc Phuc wrote:
> I want to execute polymorphism.
>

I said (a long time ago):

...BUT the OP didn't ask about polymorphism and php
doesn't support it at all anyway.

Rob replied (also quite a long time ago):

Ummm, PHP supports polymorphism.. it has at least since PHP 4.

    http://whatis.techtarget.com/definition/0,,sid9_gci212803,00.html

1 and 3 in the above link are supported. Number 2 is not, however, that

PHP supports 1 - but I have never heard of dynamic typing referred to as
polymorphism.

PHP doesn't support 2 - in so far as you can't define mabny functions with
the same name (but different signatures) - this is usually referred to as
overloading. - granted we have __call() on objects/classes which allows you
to implement functionality that work like this.

is usually referred to as function/method overloading and not so often
by polymorphism. Number 3 is the most common type when discussing
polymorphism.

in php's case this comes down to the same thing as 1. - dynamic typing of
variables.

BUT there is a fourth form of polymorphism - one I would argue if the
most common form when speaking about polymorphism with respect to programming,
namely the ability to derive a subclass from more than one base class (simutaneously),
this is something that php cannot do (thank <deity>).


Cheers,
Rob.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux