> The only use for THIS in an OO-based component is to return THIS at
> the end of the constructor. That returns the entire component for use
> as an instance.

In Java, the constructer is for providing arguments with default
values. These default values can be the ones that are automaticly
assigned to each corresponding data type, or if you create a
constructer method it will be the values you specify.

> The properties will be in the VARIABLES scope; they can be used via
> getter and setter methods. This is where the ARGUMENTS scope comes in
> - the setter methods take an argument, check it for validity and then
> set a value in the VARIABLES scope. The VARIABLES scope remains
> between method calls, acting as storage within the instance.

So within my setter method I would do something like the following:

<cfargument name="this.name" type="string" default="">
<cfset variables.name = this.name>

The intention would be to make the "name" property persist across
method calls? I don't think I really understand what that means. I am
thinking in terms of sessions and applications but I don't think their
related. If I assign something to the session scope, the variable
remains the same throught the entire session unless it is changed by
another assignment. If an object is instantiated, all properties in
the variable scope will remain the same on the calling page, but what
about on other pages? What is the life cycle of an instance?

Sorry for all the questions... I hope someone else relieves you from
doing all the work of saving me from despair...

Thanks so much,
Aaron

On 2/16/06, James Holmes <[EMAIL PROTECTED]> wrote:
> The only use for THIS in an OO-based component is to return THIS at
> the end of the constructor. That returns the entire component for use
> as an instance.
>
> The properties will be in the VARIABLES scope; they can be used via
> getter and setter methods. This is where the ARGUMENTS scope comes in
> - the setter methods take an argument, check it for validity and then
> set a value in the VARIABLES scope. The VARIABLES scope remains
> between method calls, acting as storage within the instance.
>
> On 2/17/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> > What about the constructor function? Shouldn't I set the properties in
> > the THIS scope when initializing a component?
> >
> > Also, what is the difference between the variables scope and the
> > arguments scope withing a method? I have seen properties defined using
> > the cfargument tag referenced in the method using both the arguments
> > scope and the variables scope.
>
> --
> CFAJAX docs and other useful articles:
> http://jr-holmes.coldfusionjournal.com/
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232668
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to