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

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

 



Dave Goodchild wrote:
That is not polymorphism - that is multiple inheritance. Java can't do

well 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 - multiple

no 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@xxxxxxxxxxxxx <mailto:jochem@xxxxxxxxxxxxx>> 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.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




--
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!

--
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