Let’s assume
public abstract class Game
{
// Base
}
public class Poker : Game
{
// Lobby Object
// NUMBER OF PLAYERS ( Max ) ----------
} '
'
public class Lobby '
{ '
// List<Tables> '
} '
'
public class Table '
{ '
// List<Player> <---------'
}
How to access NUMBER OF PLAYERS from Table Object without redundant passing ?
EDIT I
You misunderstood my question, I’m sorry.
I want to access the maximum number that can join this Table from its game type.
So if It’s a Poker table I want to get NUMBER OF PLAYERS which is equal 10
EDIT II
Different Game types: Hearts, Spades, Poker, Estimation, … etc
Max number of players are : 4, 4, 10, 4, etc respectively.
EDIT III
Again, misunderstood my question, I want to be able to do the following :
When player attempt to join a table, I compare target table current
players number with its game type max number of players, so I decide
if the player can or can’t join it !
I think that the following relationship needs to be modelled:
Inject the
Gamebeing played when theTableis instanced:To get the max number of players allowed in a
Tableinstance: