At 5:31 10 Oct 1999 -0600, Robert Simmons Jr. wrote:
> I have a gizmo that keeps track of resources for a program. The problem
> is that Im ending up passing this gizmo to every child component and
> that is beginning to bug me. In C++ I ould just create a global static
> var and let everyone access it. This is one of those rare cases where
You are looking for something called the singleton pattern. Take a look at
http://www.alumni.caltech.edu/~croft/research/java/pattern/
(or do your own search :)
Keep in mind if you use the first Singleton.java that you need to
Class.forName() or otherwise initialise the class so it makes it into the
VM in the first place.
Paul
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]