LarsGast / DeckOfPlayingCards

Simple code to play with a standard deck of 52 cards
MIT License
0 stars 0 forks source link

Public cards property #6

Closed LarsGast closed 1 year ago

LarsGast commented 1 year ago

Is your feature request related to a problem? Please describe. The _cards property of the Deck class is set to private. The means you can't access the cards other than drawing them one by one.

Describe the solution you'd like Make the private _cards property a public cards property with a private setter.

Describe alternatives you've considered Having a public setter for this property would mean one could change the cards in the deck. This seems counter intuitive, as the deck has already been built. We could add an optional parameter to the Deck.get() functions to let the user choose which cards the deck consists of, in another issue.

Additional context Having a public get and a private set means the user can only read the cards, and not alter them. This should be safe enough.