Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Appending functions to an object

1 view
Skip to first unread message

Bjarte

unread,
Dec 5, 2008, 4:40:23 AM12/5/08
to
I want to extend an object with multiple cfc (with extends="" I can
only do one).

For that I have created a private function _inject(), that exends my
original component with the functions from new components. This works
when I tested it in cf8, but all the function names became uppercase.
So is there a structInsert() like function that works with objects, or
any java functionality that can help me with this?

<cfcomponent>

<cffunction name="init" type="myfirstcomponent">
<cfset _inject('mysecondcomponent')>
<cfset _inject('mythirdcomponent')>
<cfreturn this>
</cffunction>

<cffunction name="_inject">
<cfargument name="obj" type="string">
<cfset var tmp = CreateObject('component",arguments.obj)>
<cfset var itm = "">
<cfloop collection="#tmp#" item="itm">
<cfset 'this.#itm#" = tmp[itm]>
</cfloop>

</cffunction>
</cfcomponent>

0 new messages