Blackjack
Loading...
Searching...
No Matches
Public Member Functions | List of all members
User Class Reference

#include <user.h>

Inheritance diagram for User:
Player

Public Member Functions

 User (const int playerLimit)
 
void chance (Deck &deck) override
 Ask the user if he wants to HIT or STAND.
 
void hit (Deck &deck) override
 Compute the score based on the card the user is dealt.
 
- Public Member Functions inherited from Player
 Player ()
 
 Player (std::string_view name, const int playerLimit)
 
virtual ~Player ()=default
 
std::string_view getName () const
 Get the player's name.
 
int getScore () const
 Get the player's score.
 
bool isBusted () const
 Return if a player is busted.
 
bool isStand () const
 Return if a player STANDS.
 
void setOutcome (Outcome outcome)
 Set the player's outcome upon finishing the game.
 
Outcome getOutcome () const
 Get the outcome of the player's game.
 
void reset ()
 Reset the scores and status of the players (to play another game)
 
virtual void chance (Deck &deck)=0
 Defines the chance of a player.
 
virtual void hit (Deck &deck)=0
 Defines the actions performed when a player HITS (as opposed to STANDS).
 

Additional Inherited Members

- Protected Attributes inherited from Player
std::string_view m_name {}
 
const int m_limit {}
 
int m_score {}
 
bool m_stand {}
 
bool m_busted {}
 
Outcome m_outcome {}
 

Constructor & Destructor Documentation

◆ User()

User::User ( const int  playerLimit)
inline

Member Function Documentation

◆ chance()

void User::chance ( Deck deck)
overridevirtual

Ask the user if he wants to HIT or STAND.

Implements Player.

◆ hit()

void User::hit ( Deck deck)
overridevirtual

Compute the score based on the card the user is dealt.

Implements Player.


The documentation for this class was generated from the following files: