The main reason I do it is so I can then say:

foo = createObject("component","foo").init();

Basically, since "this" is a reference to the public scope of the CFC
instance you can call init on the same line as the createObject call.





> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Nando
> Sent: Monday, November 03, 2003 7:03 PM
> To: [EMAIL PROTECTED]
> Subject: [CFCDev] cfreturn this ???
>
>
> Hi,
>
> I'm a little foggy on what returning "this" actually does for you
> in an init
> method.
>
> What's the practical difference between
>
>       <cffunction name="init" access="public"
> returntype="com.User" output="no">
>               ...
>       <cfreturn this />
>       </cffunction>
>
> and
>
>       <cffunction name="init" access="public" output="no">
>               ...
>       </cffunction>
>
> Knowing this a little more clearly would help me to understand
> exactly what
> i'm doing here, and when it would be advantagous or correct to return the
> object.
>
> :)
>
> thanks,
>
> Nando
>
>

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to