Re: Polymorphism [was] [Fwd: Re: [PHP] Parents constructor]
| From: | Dave Goodchild | Date: | Wed, 03 May 2006 14:39:43 +0000 |
| Subject: | Re: Polymorphism [was] [Fwd: Re: [PHP] Parents constructor] | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235374@lists.php.net to get a copy of this message | ||
That is not polymorphism - that is multiple inheritance. Java can't do that
either, and uses a much cleaner method - interfaces. And interfaces are
supported in php5. So php does allow it. Not polymorphism - multiple
inheritance. Not multiple inheritance - interfaces.
On 03/05/06, Jochem Maas <jochem@iamjochem.com> wrote:
-------- Original Message -------- On Fri, 2006-03-24 at 10:50, Jochem Maas wrote: Pham Huu Le Quoc Phuc wrote:-- http://www.web-buddha.co.uk dynamic web programming from Reigate, Surrey UK (php, mysql, xhtml, css) look out for project karma, our new venture, coming soon!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.html1 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