> -----Original Message-----
> From: Jeff Small [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 28, 2004 12:18 PM
> To: CF-Talk
> Subject: Re: My Init() in my CFC...am I on the right track?
> 
> 
> I'm struggling with "this". I don't understand even from Seans's post what
> purpose it serves to return "this" when you're using something like
> CFOBJECT
> or "CreateObject()" which creates an instance of an object anyway...

It helps me (but isn't completely correct) to think of the createObject()
call as a "blank CFC".  The init() call populates it to make it useful.

A metaphor might be a bunch of blank paper - all different sizes and shapes.
You first choose one (deciding that piece has the properties you need), then
your write your note on it (deciding what, specifically that appropriate
piece will do).

Assume a "Recipe" CFC.  The CFC instance begins as a blank index card.  Your
init() adds (via arguments, a database call or whatever) three properties:
"Name", "Ingredients" and "Directions".

In pseudo code it might look like:

<cfset MyRecipe = CreateObject("Get One Blank 4x5 Index Card").init("Write
Recipe for Ice Cubes on Index Card") />

<cfoutput>
        <h1>#MyRecipe.getName()#</h1>
        <p>#MyRecipe.getIngrediants()#</p>
        <p>#MyRecipe.getDirections()#</p>
</cfoutput>

(The above brought to you by the Coalition to Prevent the Proliferation of
Automobile Metaphors in Technical Discussion.)

Jim Davis



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net
http://www.cfhosting.net

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188881
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to