Odd question - why do you care if the methods are exposed?

If they are meant to be exposed, what is the point of hiding them?

Mark

On Wed, Oct 6, 2010 at 11:16 AM, Tony Bentley
<cascadefreehee...@gmail.com>wrote:

>
> Thanks Matt. I think I understand the difference between the two
> scopes and why not to use the this scope. For the very reason I am
> needing! In most cases it isn't a problem but when methods are exposed
> it becomes apparent.
>
> - Tony Bentley
> (sent from iPhone)
>
> On Oct 5, 2010, at 3:11 PM, Judah McAuley <ju...@wiredotter.com> wrote:
>
> >
> > Matt, do you know of a good rundown on the difference between This and
> > Variables scope in a CFC? I have a basic understanding of it but it is
> > always been something I wanted to make sure I understood the fine
> > distinctions in, kind of like the difference between var scoped
> > variables and the local scope in CF9.
> >
> > Cheers,
> > Judah
> >
> > On Tue, Oct 5, 2010 at 3:00 PM, Matt Quackenbush <quackfu...@gmail.com>
> wrote:
> >>
> >> I don't think I am actually understanding the question at hand, but
> >> hopefully this will at least help you out.
> >>
> >> First of all, I would strongly discourage anyone from using the "this"
> scope
> >> of the CFC. �There are a variety of reasons for that recommendation, but
> >> chief among them is the ability to access and change the instance data
> from
> >> outside of the object.
> >>
> >> Instead, you will want to use the "variables" scope, and have getX() and
> >> setX() methods to access/change the instance data.
> >>
> >> Now then, if you are wanting a struct representing the instance data,
> then
> >> you would create a getMemento() method to return that, which would look
> >> something like the following:
> >>
> >> public struct function getMemento()
> >> {
> >> � � // duplicate it so the internal data cannot be changed outside of
> the
> >> object
> >> � � return duplicate(variables);
> >> }
> >>
> >> These are just general guidelines and may/should change based upon your
> >> actual needs.
> >>
> >> HTH
> >>
> >>
> >>
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337885
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to