Cam
Cam

Reputation: 15234

Variable accessible to all instances of a class

Let's say I have a lookup table which I'd like to make accessible to all instances of Foo. Should I make the table private static? If not, what should I do?

Basically I want a way to save just one copy of the table (so it doesn't consume extra memory for each instance of Foo) and have it available privately to all instances of Foo.

Upvotes: 0

Views: 669

Answers (1)

Ben Zotto
Ben Zotto

Reputation: 71018

That sounds like private static to me.

Upvotes: 2

Related Questions