Application.cfc
- onapplicationstart
  <cfset server.myStaticClass =
CreateObject("component",mystaticclass)>

then reference the information as

server.myStaticClass.getStaticVar();

there ya go. It's not _technically_ a static class, but it's as close
as CF offers.

> That doesn't really cover "static," though - what makes a
> static
> member static is that it belongs to the type instead of
> one instance
> of a type.  I.e.:

> InstanceOne.StaticVar = 1
> InstanceTwo.StaticVar = 2

> <!--- Would show "2" if we had statics --->
> <cfoutput>#InstanceOne.StaticVar#</cfoutput>

> On Wed, 23 Feb 2005 16:52:52 -0500, S. Isaac Dealey
> <[EMAIL PROTECTED]> wrote:
>> > I use the 'this' scope for what would be public static
>> > final variable
>> > in Java.  That is, values that are of use both inside
>> > and
>> > outside a
>> > class, but never change.  CF doesn't give you the
>> > ability
>> > to actually
>> > make them read-only (or make them class fields, rather
>> > than instance
>> > fields), but that's an lack of functionalitythat I live
>> > with.
>>
>> yes and no...
>>
>> <cfcomponent name="static">
>>         <cffunction name="getMyVar">
>>                 <cfretrun 1>
>>         </cffunction>
>> </cfcomponent>
>>
>> It's not technically a variable, rather it's a method
>> which returns a
>> hard-coded value -- but because it's not actually stored
>> in a
>> variable, it becomes essentially a constant. You can call
>> static.getMyVar() to return the value but unless you
>> extend the
>> component you'll never be able to change what getMyVar()
>> returns.
>> Which covers public and static... I'll grant that it
>> doesn't allow you
>> the "final" part of what would be available with Java.
>>
>> s. isaac dealey   954.927.5117
>> new epoch : isn't it time for a change?
>>
>> add features without fixtures with
>> the onTap open source framework
>> http://www.fusiontap.com


s. isaac dealey     954.927.5117
new epoch : isn't it time for a change?

add features without fixtures with
the onTap open source framework

http://macromedia.breezecentral.com/p49777853/
http://www.sys-con.com/story/?storyid=44477&DE=1
http://www.sys-con.com/story/?storyid=45569&DE=1
http://www.fusiontap.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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:196232
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