Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / June 2005



Tip: Looking for answers? Try searching our database.

Variables Declared in a .cfc

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jeby - 30 Jun 2005 20:26 GMT
1)   If i declare a variable inside the <cfcomponent> and </cfcomponent> tags
it is accessble by all of the functions in the component correct?

2)  Are they also accessable outside of the component or do they have to be
returned?

Josh
Adam Cameron - 30 Jun 2005 23:44 GMT
> 1)   If i declare a variable inside the <cfcomponent> and </cfcomponent> tags
> it is accessble by all of the functions in the component correct?
>  2)  Are they also accessable outside of the component or do they have to be
> returned?

<cfset variables.foo = "bar"><!--- accessible to entire CFC instance --->
<cfset foo = "bar"><!--- same variables as above, therefore: accessible to
entire CFC instance --->
<cfset var foo = "bar"><!--- (in a function) accessible only to that
function-instance's code --->
<cfset this.foo = "bar"><!--- accessible to the calling code as myObj.foo
--->

HTH.

Signature

Adam

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.