jeby wrote:
> Can someone explain to me how this can be done? Thanks!
>
How this is done depends largely on how the objects are
related to each
other. I.E. Does one object extend (inherit) the other object
creating
an is-a or parent child relationship. Or does one object
contain an
instance of the other as a property|variable (composite)
creting an
has-a relationship.
I'm doing some web service with complex object testing and I
have just
written this simple testing code. See if it makes some sense
to you.
basic.cfc
---------
<cfcomponent>
<cfproperty name="foo" type="string">
<cfproperty name="bar" type="string">
<cfscript>
this.foo = "George";
variables.bar = "Gracie";
</cfscript>
<cffunction name="getBar" access="remote"
returntype="string">
<cfreturn variables.bar>
</cffunction>
</cfcomponent>
complex.cfc
-----------
<cfcomponent>
<cfproperty name="anObj" type="basic">
<cfscript>
variables.anObj = createObject("component","basic");
</cfscript>
<cffunction name="getObj" access="remote"
returntype="basic">
<cfreturn variables.anObj>
</cffunction>
</cfcomponent>
index.cfm
---------
<cfscript>
complexComp = createObject("component","complex");
</cfscript>
<cfdump var="#basicComp#" expand="no">
<dl>
<dt>complexComp.getObj()</dt>
<dd><cfdump
var="#complexComp.getObj()#"></dd>
<dt>complexComp.getObj().foo</dt><
dd>#complexComp.getObj().foo#</dd>
<dt>complexComp.getObj().getBar()</dt>
<dd>#complexComp.getObj().getBar()#</dd>
</dl>