Blackjack Program  Iteration 2
Core Exercise HIT3172
 All Classes Functions Variables Enumerations Enumerator
Public Types | Public Member Functions | Private Attributes | List of all members
card Class Reference

#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

Detailed Description

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

Member Enumeration Documentation

enum card::rank

Enum for all possible card ranks

Rank starts at one instead of zero for ease-of-use, be care

Enumerator:
ACE 

ACE.

TWO 

TWO.

THREE 

THREE.

FOUR 

FOUR.

FIVE 

FIVE.

SIX 

SIX.

SEVEN 

SEVEN.

EIGHT 

EIGHT.

NINE 

NINE.

TEN 

TEN.

JACK 

JACK.

QUEEN 

QUEEN.

KING 

KING.

RANK_MAX 

Symbolic Sentinel value for the last possible rank (not a valid rank)

enum card::suit

Enum for all possible card suits

Enumerator:
CLUB 

CLUB.

DIAMOND 

DIAMOND.

HEART 

HEART.

SPADE 

SPADE.

SUIT_MAX 

Symbolic Sentinel value for the last possible suit (not a valid suit)

Constructor & Destructor Documentation

card::card ( rank  r,
suit  s 
)

Card constructor with parameters to initialise which card it represents

Parameters
rrank
ssuit

Member Function Documentation

card::rank card::get_rank ( )

Get the rank of the Card object

Returns
rank of the card
card::suit card::get_suit ( )

Get the suit of the Card object

Returns
suit of the card
bool card::is_faceup ( )

Get if the card is face up or not

Returns
true if the Card is face up
std::string card::str ( )

Get a string representation of the card

Returns
a string representation of the card
void card::turn_over ( )

Turn the card over

Member Data Documentation

bool card::_faceup
private

Stores whether the Card object is face up (true) or face down (false)

rank card::_rank
private

Stores the rank of the Card object

suit card::_suit
private

Stores the suit of the Card object


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