On Thursday, Jul 24, 2003, at 11:38 US/Pacific, Raymond Camden wrote:
function init(arg1,arg2) {

        make new instance of cfc
        ob.setArg(arg1);
        ob.setArg(arg2);
        return ob;
}

and in the caller:

<cfset foo = createObject("component","thecfc").init("your","mother")>

If you're calling 'init()' on the result of 'createObject()' like that then your pseudo code should NOT be making a new instance - the cfset line would then create *two* instances!


The 'init()' method should be a fully fledged method of the CFC like this:

        <!--- in component foo.cfc --->
        <cffunction name="init" returntype="foo">
                <cfargument name="arg1" type="xxx" />
                <cfargument name="arg2" type="xxx" />
                <cfset instance.arg1 = arguments.arg1 />
                <cfset instance.arg2 = arguments.arg2 />
                <cfreturn this />
        </cffunction>

(this assumes the - fairly common - 'instance' idiom used in place of the basic unnamed scope)

Sean A Corfield -- http://www.corfield.org/blog/

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood

----------------------------------------------------------
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).

Reply via email to