Blackjack Program
Iteration 2
Core Exercise HIT3172
|
#include <card.h>
Public Types | |
enum | suit { CLUB, DIAMOND, HEART, SPADE, SUIT_MAX } |
enum | rank { ACE = 1, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, RANK_MAX } |
Public Member Functions | |
card (rank r, suit s) | |
void | turn_over () |
std::string | str () |
suit | get_suit () |
rank | get_rank () |
bool | is_faceup () |
Private Attributes | |
suit | _suit |
rank | _rank |
bool | _faceup |
Card class represents a card and what the card knows and it can do For example it knows what rank and suit it is, and if it is face up and can turn it self over
enum card::rank |
Enum for all possible card ranks
Rank starts at one instead of zero for ease-of-use, be care
enum card::suit |
Card constructor with parameters to initialise which card it represents
r | rank |
s | suit |
card::rank card::get_rank | ( | ) |
Get the rank of the Card object
card::suit card::get_suit | ( | ) |
Get the suit of the Card object
bool card::is_faceup | ( | ) |
Get if the card is face up or not
std::string card::str | ( | ) |
Get a string representation of the card
void card::turn_over | ( | ) |
Turn the card over
|
private |
Stores whether the Card object is face up (true) or face down (false)
|
private |
Stores the rank of the Card object
|
private |
Stores the suit of the Card object