//----------------- CARDDECK.H ----------------- // These are the declarations of classes Card // and Deck, to be used by card-playing programs. #include using namespace std; enum Suit {CLUBS, DIAMONDS, HEARTS, SPADES}; class Card // this class describes a single card { friend ostream& operator<< (ostream& os, const Card& c); public: void Display(ostream& os = std::cout) const; // for displaying a card in a readable fashion int GetVal() const; // retrieves the card's value void SetVal(int); // sets the card's value to the value provided Suit GetSuit() const; // retrieves the card's suit void SetSuit(Suit); // sets the card's suit to the suit provided private: Suit s; // each card has a suit int val; // and a value (2 ... 14, representing 2 ... Q, K, A) }; class Deck // This class describes a collection of 52 cards { public: Deck(int num = 1); // build a card "deck" out of num standard decks ~Deck(); // destructor for cleanup Deck(const Deck& d); // copy constructor Deck& operator=(const Deck& d); // assignment operator for deep copy void Dump() const; // output dump of object for testing purposes void Shuffle(); // shuffle the cards in the deck void ShuffleRest(); // shuffle the REST of the currently undealt cards Card DealCard(); // deal one card from the deck (and return it) int TopCard() const; // return top card position private: int topCard; // points to position of current top card of deck int numCards; // total number of cards in our deck Card * cards; // a deck is an array of cards (dynamic) void Clone(const Deck& d); // make a deep copy -- helper function };