The variables scope, when used within a CFC, is a protected private scope (only accessible from within the CFC). Within the head of your object (after the cfcomponent tag, but prior to any functions) you may have a block like this:
<cfscript> variables.instance = structnew(); variables.instance.firstname = ""; variables.instance.lastname = ""; variables.instance.age = 0; </cfscript> Then you might have an init method like this: <cffunction name="init" access="public" output="false" returntype="person" hint="This initializes your person object"> <cfreturn this> </cffunction> You would then get or set the properties of your object using getter and setter methods, which can access the private variables scope: <cffunction name="setFirstName" access="public" output="false" returntype="void" hint="Sets the firstname property of this instance"> <cfargument name="firstname" type="string" required="true" hint="firstname to set in this instance of person"> <cfset variables.instance.firstname = arguments.firstname> </cffunction> <cffunction name="getFirstName" access="public" output="false" returntype="string" hint="Returns the firstname of this person instance"> <cfreturn variables.instance.firstname> </cffunction> So, within your calling template you might have: <cfset variables.personObj = createobject("component","person").init()> After which, the following attempt to access it's properties would fail/error: #variables.personObj.firstname# But using this would give you access: #variables.personObj.getFirstName()# Hope this helps:) Cutter _________ http://blog.cutterscrossing.com Victor Moore wrote: > Hi, > > I have seen in a number of examples the following: > > <cfset variables.myVar = arguments.someArg /> > any particular reason/advantage why the arguments are assigned to a local > variable inside a cfc function instead of using it directly? > > Thanks > Victor > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting, up-to-date ColdFusion information by your peers, delivered to your door four times a year. http://www.fusionauthority.com/quarterly Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:253007 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4