Global Class
Posted: Mon Aug 14, 2006 9:17 am
What is the procedure for a class that meets the following criteria:
1. May be called from many other classes
2. Generally, only 1 instance is needed, but sometimes more (ie cannot be a Singleton
3. Has already been instantiated before any other classes
Using a global var would be easy but I'm not sure that is the proper method.
I don't want to instantiate it everytime I need it, but sometimes I will need to have 2 or more copies of it running concurrently. Would it be best to simply make a copy of it?
EDIT: Also, what would be the best way to call this class from other classes?
1. May be called from many other classes
2. Generally, only 1 instance is needed, but sometimes more (ie cannot be a Singleton
3. Has already been instantiated before any other classes
Using a global var would be easy but I'm not sure that is the proper method.
I don't want to instantiate it everytime I need it, but sometimes I will need to have 2 or more copies of it running concurrently. Would it be best to simply make a copy of it?
EDIT: Also, what would be the best way to call this class from other classes?