That is correct, and in response to your other question regrading import. This works in the same way as Java, in other words that means that you can import a folder and reference the cfc via just the name as Paul has done.
On a side note I would question which method is actually faster, the metadata or the new operand. I would consider that the new operand would be faster than using the metadata approach. Anyone actually tried it to see what the difference actually is? On Thu, Jul 14, 2011 at 12:23 PM, Steve Onnis <[email protected]>wrote: > Ok so if i have a cfc named FooBar.cfc, from within that CFC i can make a > call new FooBar() and i will have a new instance of the CFC? > > -----Original Message----- > From: Paul Kukiel [mailto:[email protected]] > Sent: Thursday, 14 July 2011 8:55 AM > To: cfaussie > Subject: [cfaussie] Re: CreateObject of itself > > Hi Steve, > > I believe this is what your trying to achieve: > > http://pastebin.com/hJmsEvaA > > Running code: http://demo.kukiel.net/cfaussie.cfm > > Paul > > On Jul 13, 8:37 pm, "Steve Onnis" <[email protected]> wrote: > > Can anyone suggest a way i can create a new reference to a cfc that i am > > already in? > > > > Something like.... > > > > FooBar.cfc > > > > <cfcomponent> > > > > <cfproperty name="fooProp" type="string" /> > > > > <cffunction name="bar" output="false"> > > > > <cfscript> > > > > LOCAL.tmpArr = []; > > > > for (LOCAL.i = 1; LOCAL.i LTE 10; LOCAL.i = LOCAL.1+1) > { > > > > LOCAL.tmpObj = new this; > > > > LOCAL.tmpObj.setfooBar("Some String #LOCAL.i#"); > > > > ArrayAppend(LOCAL.tmpArr, LOCAL.tmpObj); > > > > } > > > > </cfscript> > > > > </cffunction> > > > > </cfcomponent> > > > > Obviously "new this;" wont work. > > > > I want something to replace > > > > LOCAL.tmpObj = createObject("COMPONENT", "FooBar"); > > > > Ideas? > > > > Steve > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > > -- > You received this message because you are subscribed to the Google Groups > "cfaussie" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/cfaussie?hl=en. > > -- You received this message because you are subscribed to the Google Groups "cfaussie" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cfaussie?hl=en.
