Following is just interesting, when I read about CFC scopes I always hear
about the private and public scope, i.e.

this.test = public
variables.test = private
test = private

But it appears that the name of the object is also a (seperate) private
scope, see following:

****** Save as ScopeTest.cfc
<cfcomponent extends="Parent">

     <cfscript>
     ScopeTest.test = "Hello there! I'm in the ScopeTest Scope";
     variables.test = "Hello there! I'm in the ScopeTest Variables";
     //Parent.test = "Hello there! I'm in the Parent Scope";
     test = "Hello there! I'm in the unknown Scope";
     this.test = "Hello there! I'm in the this Scope";
     </cfscript>

     <cffunction 
          name="test1" 
          access="public" 
          returntype="string">

          <cfreturn ScopeTest.test>
     </cffunction>

     <cffunction 
          name="test2" 
          access="public" 
          returntype="string">

          <cfreturn variables.test>
     </cffunction>

     <cffunction 
          name="test3" 
          access="public" 
          returntype="string">

          <cfreturn Parent.test>
     </cffunction>

     <cffunction 
          name="test4" 
          access="public" 
          returntype="string">

          <cfreturn test>
     </cffunction>

     <cffunction 
          name="test5" 
          access="public" 
          returntype="string">

          <cfreturn this.test>
     </cffunction>

</cfcomponent>

***** Save as Parent.cfc

<cfcomponent>

     <cfscript>
     Parent.test = "Hello there! I'm in the Parent Scope1";
     </cfscript>

</cfcomponent>

****** Code to test

<cfscript>
Object = createObject( "component", "ScopeTest" );
</cfscript>
<cfoutput>
#Object.test1()#<br>
#Object.test2()#<br>
#Object.test3()#<br>
#Object.test4()#<br>
#Object.test5()#<br>
</cfoutput>

Is this already documented and known, or am I off with the fairies again??
You would think that [object name] would be the same as [this], not?
 
Taco Fleur
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support 
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189474
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to