Well, yeah. That's a way to do it.
Is anyone else conflicted as to how many workaround we should make to
enable OOP in CF when we're already able to develop some pretty nice
applications?
-Joe
On Wed, 23 Feb 2005 18:37:07 -0500, S. Isaac Dealey <[EMAIL PROTECTED]> wrote:
> 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
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking
application. Start tracking and documenting hours spent on a project or with a
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196246
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