OK well that much I know, but  that fact seems kinda moot and pedantic, cozz
if someone can do that, then obviously must have complete access to your
code anyway to be able to call your CFC directly and access it's public
member vars in the first place.
I thought he was trying to imply that I could somehow get at those variables
remotely.
Obviously if a CFC is private, it should be set as such, otherwise your gonn
ahave a lot more problems.

Russ 

-----Original Message-----
From: Rob Wilkerson [mailto:[EMAIL PROTECTED] 
Sent: 31 March 2006 02:24
To: CF-Talk
Subject: Re: CFWDDX and Component Objects

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:236666
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