Re: Using a Resource as a Class Property
- From: Sanders Kaufman <bucky@xxxxxxxxxxx>
- Date: Mon, 23 Jul 2007 15:10:21 GMT
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?
- Follow-Ups:
- Re: Using a Resource as a Class Property
- From: Jerry Stuckle
- Re: Using a Resource as a Class Property
- References:
- Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Michael Fesser
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Re: Using a Resource as a Class Property
- From: Toby A Inkster
- Re: Using a Resource as a Class Property
- From: Sanders Kaufman
- Using a Resource as a Class Property
- Prev by Date: Re: Creating an array from an HTML table
- Next by Date: Re: Using a Resource as a Class Property
- Previous by thread: Re: Using a Resource as a Class Property
- Next by thread: Re: Using a Resource as a Class Property
- Index(es):
Relevant Pages
|