On Thursday, Jan 30, 2003, at 15:02 US/Pacific, Andy Ousterhout wrote:
> What does:
>       <cfset instance = structNew()>
>
> do for your component?

Just to remind people of the context:
>       <!--- person.cfc --->
>       <cfcomponent>
>               <!--- create a single 'handle' for your instance data: --->
>               <cfset instance = structNew()>

This is outside any cffunction so it is "constructor" code - run as an 
instance is created. That means that it is run whenever you cfinvoke 
the component or createObject() it. It creates an internal variable, 
called "instance", that exists for the duration of the CFC object 
(short-lived in a cfinvoke, longer-lived in a createObject()).

>               <!--- setter: --->
>               <cffunction name="setFirstName" returntype="person">
>                       <cfargument name="firstName" type="string" required="true">
>                       <cfset instance.firstName = arguments.firstName>

This makes it clear that I'm updating instance data, i.e., an internal 
variable for this CFC object instance.

Does that help?

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to