would a players score in a game or a players money in a casino typically be a static variable? just wondered if that was typically used in a scenario like this
can you give me any other practical examples?
The casino's money could be static. I wouldn't think the player's money/score would be static because there are presumably many players. So I'd expect a Player object for each one. An ArrayList of all the known Player objects would makes sense as static though.
There are many casinos around the world, so I would have a Casino class.
Each instance of Casino would have many instances of CasinoGame, an abstract class.
There would be subclasses of CasinoGame: Blackjack, Poker, Roulette, etc.
Each casino would also have many instances of registered Player.
Each game would also have possibly many instances of Player, each of which must come from that casino's list of Players..
None of those classes would have any static variables.
One possible value I could think of as being static might be a 'banned player list'. As is usual in somewhere like Vegas, if a player is banned from one casino, they are blacklisted from other casino's in the same area.
But then this [possibly] wouldn't apply to casino's outside the area. It depends on what your problem domain relating to casino's is?
posted 2 years ago
L Hasan wrote:One possible value I could think of as being static might be a 'banned player list'. . . .