Whatever message this page gives is out now! Go check it out!
<cfset This.color="green"><cfset Variables.MyName="Wilson">
<cfobject component="greetMe" name="myGreetings">
<cfoutput>
Before invoking the CFC, Variables.Myname is: #Variables.MyName#.<br>
Passing Variables scope to hello method. It returns: #myGreetings.hello(Variables.MyName)#.<br>
After invoking the CFC, Variables.Myname is: #Variables.MyName#.<br>
</cfoutput>
<cfinvoke component="greetMe" method="VarScopeInCfc"><cfcomponent>
<cfset Variables.MyName="Tuckerman">
<cffunction name="hello">
<cfargument name="Name" Required=true>
<cfset Variables.MyName="Hello " & Arguments.Name>
<cfreturn Variables.MyName>
</cffunction>
<cffunction name="VarScopeInCfc">
<cfoutput>Within the VarScopeInCfc method, Variables.MyName is: #variables.MyName#<br></cfoutput>
</cffunction>
</cfcomponent>Before invoking the CFC, Variables.Myname is: Wilson.
Passing Variables scope to hello method. It returns: Hello Wilson.
After invoking the CFC, Variables.Myname is: Wilson.
Within the VarScopeInCfc method, Variables.MyName is: Tuckerman<cffunction ...>
<cfset Var testVariable = "this is a local variable">
<!--- Function code goes here. --->
<cfreturn myresult>
</cffunction>component {
// instance constructor body
writedump("non static")
// static constructor body
static {
writeDump("static")
}
}<cfscript>
new Case1()
new Case1()
</cfscript>component {
// static constructor body
static {
Static.counter = 0;
}
static.counter++;
writeDump(static.counter&" instances used so far");
}<cfscript>
new Case2()
new Case2()
new Case2()
</cfscript>component {
/**
* splits a full name in half
*/
public static function splitFullName(required string fullName) {
var arr=listToArray(fullName," ");
return {'lastname':arr[1],'firstname':arr[2]};
}
}<cfscript>
writedump(Case3::splitFullName("John Doe"))
</cfscript>private static.variable1 = 90public static.foo = 67static {
private var2 = 90
package count = 89
}