Re: Polymorphism [was] [Fwd: Re: [PHP] Parents constructor]
| From: | Jochem Maas | Date: | Wed, 03 May 2006 14:59:21 +0000 |
| Subject: | Re: Polymorphism [was] [Fwd: Re: [PHP] Parents constructor] | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-235377@lists.php.net to get a copy of this message | ||
Dave Goodchild wrote:
That is not polymorphism - that is multiple inheritance. Java can't dowell that clears up my misuse of the terminology!
that either, and uses a much cleaner method - interfaces. And interfaces are supported in php5. So php does allow it. Not polymorphism - multipleno Interfaces are not a mechanism for mutliple inheritance (in php) - they don't allow definition of the of the body of functions on the signature. not that I want multiple inheritance - I live on the MI is evil side of town (even when I was calling MI by a different [and incorrect] name).
inheritance. Not multiple inheritance - interfaces.you have fluff on the needle. (record is stuck) ;-)
On 03/05/06, *Jochem Maas* <jochem@iamjochem.com <mailto:jochem@iamjochem.com>> wrote:-------- 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.html1 and 3 in the above link are supported. Number 2 is not,however, thatPHP 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 sooftenby 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-- 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!