Sorry old thread, but got a question that would fit perfectly. What is the real difference between using cfproperty and the this scope? Are the only advantages the datatype validation?
-- jon mailto:[EMAIL PROTECTED] Wednesday, August 7, 2002, 9:55:02 PM, you wrote: HH> Sean, HH> Was making the "this" scope public intentional or just something HH> inadvertent that slipped through? HH> -----Original Message----- HH> From: Sean A Corfield [mailto:[EMAIL PROTECTED]] HH> Sent: Wednesday, August 07, 2002 8:09 PM HH> To: CF-Talk HH> Subject: Re: CFC's question and the Arguments. HH> On Tuesday, August 6, 2002, at 11:13 , Hal Helms wrote: >> You can refer to a passed value either as arguments.varName or just >> varName. I personally prefer the arguments.varName. HH> I agree with Hal - be explicit. >> The "this" scope provides the global scope I think you're looking for. HH> "this" creates *public* data members that are accessible directly from HH> *outside* the component... >> <cfcomponent hint="I am a Person"> >> <cfset this.firstName = ""> >> <cfset this.lastName = ""> >> >> <cffunction name="setFirstName"> >> <cfargument name="firstName" type="string" required="yes"> >> <cfset this.firstName = arguments.firstName> >> </cffunction> >> </cfcomponent> HH> I can now do: HH> <cfset x = createObject("component","person")/> HH> <cfset x.firstName = "Mickey"/> HH> i.e., without calling setFirstName(). HH> If you want a *private* data member (and you normally should!), then use HH> the unnamed scope: HH> <cfcomponent hint="I am a Person"> HH> <cfset firstName = ""> HH> <cfset lastName = ""> HH> <cffunction name="setFirstName"> HH> <cfargument name="firstName" type="string" required="yes"> HH> <cfset firstName = arguments.firstName> HH> </cffunction> HH> </cfcomponent> ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists