Blackjack Program  Iteration 2
Core Exercise HIT3172
 All Classes Functions Variables Enumerations Enumerator
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
card_hand Class Reference
Inheritance diagram for card_hand:
blackjack_hand

Public Member Functions

 card_hand ()
void add_card (card *card)
void remove_card (int idx)
cardcard_at (int idx)
virtual std::string str ()
void return_cards ()
void reveal ()
void conceal ()
int get_score ()
int get_count ()
bool is_all_faceup ()

Protected Member Functions

virtual bool needs_evaluate ()
virtual void evaluate ()

Protected Attributes

std::vector< card * > _cards
int _score

Constructor & Destructor Documentation

card_hand::card_hand ( )

Initialise the card hand

Member Function Documentation

void card_hand::add_card ( card card)

Add a new card to the hand, and evaluates score if necessary

Parameters
cardthe card object to add to the hand
card * card_hand::card_at ( int  idx)

Get a pointer to a card in the hand

Parameters
idxthe index of the card
Returns
the card pointer
void card_hand::conceal ( )

Turns all cards face down

void card_hand::evaluate ( )
protectedvirtual

Stub for evaluate function, should be overridden by a subclass Sets score to zero

int card_hand::get_count ( )

Get the number of cards in the hand

Returns
number of cards in the hand
int card_hand::get_score ( )

Get the hand score

Returns
the hand score
bool card_hand::needs_evaluate ( )
protectedvirtual

Stub for needs_evaluate function, should be overridden by a subclass

Returns
always returns false
void card_hand::remove_card ( int  idx)

Remove a card from the hand

Parameters
idxthe index of the card in the hand
void card_hand::return_cards ( )

Removes all cards from its cards field

void card_hand::reveal ( )

Turns all cards face up

string card_hand::str ( )
virtual

Print the string representation of each card, separated by a space

Returns
a string representation of the hand

Reimplemented in blackjack_hand.


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