|
Posted by Jerry Stuckle on 07/23/07 18:43
Sanders Kaufman wrote:
> Jerry Stuckle wrote:
>> Sanders Kaufman wrote:
>
>>> Vocabulary question: When I do this, what is the OOP thing that I'm
>>> doing? You said that my use of an object as a property of the parent
>>> class was "aggregation. So - when I use use "extends" to create the
>>> child's reference to the parent - wassat? Marshalling? Inheritance?
>>
>> Inheritance.
>
> And then... overwriting functions would be polymorph?
> And... PHP allows function overwriting?
>
> Zat right?
Yes, and no. PHP doesn't have true polymorphism in the sense of other
OO languages, although what it has is effectively the same.
I say it doesn't have "true polymorphism" because PHP is an untyped
language. Typed languages such as C++ and Java differentiate between the
"apparent" type of the object (the type defined for the variable) and
the "true" type - that being what the object really is.
But since PHP variables are not typed, there is no "apparent" type - the
interpreter always knows the "true type".
So although the implementation is different - the effect is exactly the
same, and you can correctly consider it polymorphism.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Navigation:
[Reply to this message]
|