Nope. THIS refers to the object, but can be used to access public member variables from outside the object itself. Public member variables (i.e. variables initialized as this.variableName) can be modified outside of the object itself.
On any CFM template, instantiate the object and then reassign the public variable value: variables.myObject = createObject ( 'component', 'com.my.package.componentName' ); variables.myObject.publicMemberVar = 'blah'; To "protect" those variables, it's recommended that they only be accessible within the component itself with external code updating them via getter and setter functions (e.g. getPublicMemberVar() / setPublicMemberVar()). I don't know if I just confused the issue more, but the idea is to make the variables themselves *only* available for assignment within methods of the CFC. Analogous to private members in Java. On 3/30/06, Snake <[EMAIL PROTECTED]> wrote: > So what are u saying, if I create this.foo = "fo fum" inside a CFC, then > this can be accessed outside of the CFC by anyone? > Surely the THIS scope is local to the object (CFC) ? > > > > Russ > > -----Original Message----- > From: Dave Watts [mailto:[EMAIL PROTECTED] > Sent: 31 March 2006 01:14 > To: CF-Talk > Subject: RE: CFWDDX and Component Objects > > > I see a few people have a problem with using the this scope, why ? > > Because it violates the concept of encapsulation, which is one of the > primary concepts of object-oriented programming. Public member variables can > be manipulated directly from outside the object; an object should manage its > own data. > > Dave Watts, CTO, Fig Leaf Software > http://www.figleaf.com/ > > Fig Leaf Software provides the highest caliber vendor-authorized instruction > at our training centers in Washington DC, Atlanta, Chicago, Baltimore, > Northern Virginia, or on-site at your location. > Visit http://training.figleaf.com/ for more information! > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236644 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

