You can instantiate and initialize a CFC in one line.  Taking your example below
all you have to do is the following:

obj.usr = CreateObject("Component","path.to.users").init("my","passed","aruments");

The only caveat, is that your constructor must return an instance of the CFC. 
It will  look something like:

<cffunction name="init" returntype="path.to.users">
    <cfargument ...>
    <cfreturn this />
</cffunction>

Hope this helps

Sean

Quoting Ian Sheridan <[EMAIL PROTECTED]>:

> I know but I have come to terms with having 2 lines of code to 
> construct my objects
> 
> obj.usr = CreateObject("Component","path.to.users");
> obj.usr.init("my","passed","aruments");
> 
> 
> On May 24, 2004, at 1:14 AM, Jim Davis wrote:
> 
> > That should work, but it doesn't address passing parameters on
> > instantiation.
> >
> > Jim Davis
> >
> >> -----Original Message-----
> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On 
> >> Behalf
> >> Of Ian Sheridan
> >> Sent: Sunday, May 23, 2004 11:04 PM
> >> To: [EMAIL PROTECTED]
> >> Subject: Re: [CFCDev] constructors and initialisation
> >>
> >> from what I understand you can do this:
> >>
> >> <cfcomponent>
> >>    <cfscript>
> >>            init();
> >>    </cfscript>
> >>    <cffunction name="init">
> >>            your code here
> >>    </cffunction>
> >> </cfcomponent>
> >>
> >> am I wrong about this?
> 
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the words '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]
> 
> 




-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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