NEWBIE: Please advise on Static design
Posted on 2007-03-29
I have a class designed to encapsulate selections from a database table. I want to use it for two different purposes:
First, I'd like to have a basically "Static" version, that would go read all the data from the table ONCE up front, and store it "Static-ally", so any other classes can easily access it.
Second, I'd like to use the same class to be able to read particular data for particular purposes. This should NOT be static. Each user class would want it's own copy.
Could you folks advise me on how to do this?
I know my class could contain both static and non-static sets of variables, but that seems ugly. And I could have two versions of the class, but that seems wasteful...
The ideal, I think, would be to make an instance of the entire class "Static", but I've never done that and don't understand the implications.