|
Posted by Sanders Kaufman on 07/23/07 15:10
Sanders Kaufman wrote:
> Toby A Inkster wrote:
> So to correct my statement:
>
> In OOP (not just PHP) the constructor of the grandest child :) will be
> called when a class is instantiated as an object.
Wow, now that I've done it that way, I can see why it's the better way.
By having to call the parent constructor from within the child object,
It gives the child better control.
For example, my parent has a "database" object, and a built-in default
way of talking to it; while the child has another way of talking to it -
each established in the constructor, and each running a verification
process to ensure it still works
So now I can have the child set the values for the conversation before
the parent .... blah, blah, blah.
Bottom line - I talk to the DBMS once, instead of twice during
initialization.
Cool.
Thanks.
>
> Zat right?
>
> 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?
>
>
Navigation:
[Reply to this message]
|