Alex Rivera | Logout

Is what seems like polymorphism in PHP really polymorphism?

Asked 2009-04-14T23:30:09.723
25

Trying to figure out whether PHP supports features like method overloading, inheritance, and polymorphism, I found out:

  • it does not support method overloading
  • it does support inheritance

but I am unsure about polymorphism. I found this Googling the Internet:

I should note that in PHP the polymorphism isn't quite the way it should be. I mean that it does work, but since we have a weak datatype, its not correct.

So is it really polymorphism?

Edit Just can't quite place a definite YES or NO next to PHP supports polymorphism. I would be loath to state: "PHP does not support polymorphism", when in reality it does. Or vice-versa.

Edit
Report

1 Answer

4

Some call this duck typing.

answered 2009-04-15T01:35:00.300

Your Answer