Invoking Component Objects
You use the
The examples in the following sections assume that the Using propertiesUse the following coding practices to access properties. To set a property:<cfset obj.property = "somevalue"> To get a property:<cfset value = obj.property> Note that parentheses are not used on the right side of the equation for property-gets. Calling methodsObject methods usually take zero or more arguments. Arguments can be sent by value ([in] arguments) or by reference ([out] and [in,out]). Arguments sent by reference usually have their value changed by the object. Some methods return values, while others may not. Methods with no arguments:<cfset retVal = obj.Method1()> Note that parentheses are required for methods with no arguments. Methods with one or more arguments:<cfset x = 23> <cfset retVal = obj.Method1(x, "a string literal")> This method accepts one integer argument and one string argument. Methods with reference arguments:<cfset x = 23>
<cfset retVal = obj.Method2("x", "a string literal")>
<cfoutput> #x#</cfoutput>
Note the use of double-quotation marks (") to specify reference arguments. If the object changes the value of "x", it now contains a value other than 23. Calling nested objectsThe current release of ColdFusion does not support nested (scoped) object calls. For example, if an object method returns another object and you must invoke a property or method on that object, use the following syntax: <cfset objX = myObj.X> <cfset prop = objX.Property>
(The syntax
|