Well I would say you maybe working a bit too hard.

If that is all you want to do you can just do this.

<cfcomponent ....>
        <cfset variables.DSN = "myDataSourceName">

        <cffunction ...>

This sets a variable that can be used by all functions.  Now the limitation of 
this is that you can not pass parameters to this "constructor".  But since you 
stated that you did not want to pass parameters that should not be a problem.  
The reason for the defacto standard of an "init()" method is to be able to pass 
parameters to some kind of constructor like mechanism.  If parameters are not 
needed, I would feel the init() method is not needed.  But I'm sure that is 
debatable.


--------------
Ian Skinner
Web Programmer
BloodSource
www.BloodSource.org
Sacramento, CA

"C code. C code run. Run code run. Please!"
- Cynthia Dunning


<cfset init()>

<cffunction name="init" access="private" output="false" returntype="string" 
displayname="Initializes my object and creates the datasource variable">
    <cfset variables.DSN = "myDataSourceName">
    <cfreturn variables.DSN>
</cffunction>

I know I could make it so that you have to pass the datasource variable name 
in to the function, but I figured, I can always just change it in one place 
in my CFC, and it's good to go...right?

That should suit my needs, right? If I want a variable that's available to 
all the functions in my CFC...right? Am I thinking the "right way"?

Confidentiality Notice:  This message including any
attachments is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized review, use, disclosure or
distribution is prohibited. If you are not the
intended recipient, please contact the sender and
delete any copies of this message. 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Special thanks to the CF Community Suite Silver Sponsor - CFDynamics
http://www.cfdynamics.com

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:188867
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to