388
<!--- Create a two-element array, sum its values,
<cfset intarray=ArrayNew(1)>
<cfset intarray[1]=1>
<cfset intarray[2]=2>
<cfset IntVal=obj.sumarray(intarray)>
<cfset reversedarray=obj.ReverseArray(intarray)>
<!--- Display the results --->
<cfoutput>
</cfoutput><br>
<!--- Create a ColdFusion array containing two Example objects.
<cfset oa=ArrayNew(1)>
<cfobject action=create type=java class=Example name=obj1>
<cfset VOID=obj1.init(JavaCast("int",5))>
<cfobject action=create type=java class=Example name=obj2>
<cfset VOID=obj2.init(JavaCast("int",10))>
<cfset oa[1] = obj1>
<cfset oa[2] = obj2>
<cfset result = obj.SumObjArray(oa)>
<cfset intval = result.mPublicInt>
<!--- Display the results --->
<cfoutput>
</cfoutput><br>
</body>
</html>
and reverse its elements --->
<br>
IntVal1 :#IntVal#<br>
array1: #reversedarray[1]#<br>
array2: #reversedarray[2]#<br>
<br>
Use the SumObjArray method to add the objects in the array
Get the public member of the resulting object--->
<br>
intval1: #intval#<br>
<br>
Chapter 20 Using cfobject to Invoke Component Objects
Need help?
Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?
Questions and answers