> I also always return THIS from the init() method to allow me to do:
> foo = createobject("component","foo").init();
If you return THIS from the init() method, you only get reference to
Instance methods.
No Instance variables are returned.
>From the below example..
user = createObject("Component", "User");
This will fail, if you return THIS Instead of Variables.
<cfoutput>#variables.user.firstName#</cfoutput>
Are you using "This", so you can declare Accessor Methods to get Instance
Variables?
Joe Eugene
----- Original Message -----
From: "Nathan Dintenfass" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 07, 2003 11:46 AM
Subject: RE: [CFCDev] Variable referencing in CFCs
> Yes, though I set up the variables in the init() method instead of the
> pseudo-constructor area.
>
> I also usually don't put variables. in front of instance once I've created
> it.
>
> I also always return THIS from the init() method to allow me to do:
>
> foo = createobject("component","foo").init();
>
> But, you've got the idea.
>
>
> >
> > So essentially, are u saying the below is the apt usage?
> > <cfcomponent>
> > <cfset variables.instance = structNew() />
> > <cfset variables.instance.firstName = "" />
> > <cfset variables.instance.lastName = "" />
> > <cfFunction name="init" access="public" returntype="struct"
> > output="false">
> > <cfset variables.instance.firstName = "Bob" />
> > <cfset variables.instance.lastName = "Smith" />
> > <cfReturn variables.instance />
> > </cfFunction>
> > </cfcomponent>
> >
> > Joe
> >
>
> ----------------------------------------------------------
> 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]
----------------------------------------------------------
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]