Requriing static class setter to be called before Constructor, bad design?
- by roverred
I have a class, say Foo, and every instance of Foo will need and contain the same List object, myList.
Since every class instance will share the same List Object, I thought it would be good to make myList static and use a static function to set myList before the constructor is called. I was wondering if this was bad, because this requires the setter to be called before the constructor. If the person doesn't, the program will crash. Alternative way would be passing myList every time. Thanks.