Amazon Interview Question
Software Engineer / DevelopersClass Player
{
Card cards
....
}
Class Card
{
enum number
enum sign
...
}
Class CardGame
{
Player[] playersInGame
Card[] cards
DistributeCardToPlayer(Card c, Player p){}
...
}
Use a container or an array to hold card ref.
- sunbow.xs@hotmail.com September 29, 2008Player and cards are different obj.
And I think card is not a part of player. It is there no matter whether a player object is created. So use "using" is better than composition.