//****************************************************************** // SPECIFICATION FILE (carddeck.h) // This file gives the specification of a CardDeck class, derived // from the CardPile class using inheritance //****************************************************************** #ifndef CARDDECK_H #define CARDDECK_H #include "cardpile.h" const int DECK_SIZE = 52; class CardDeck : public CardPile { public: void Shuffle( /* in */ int numberOfShuffles); // Precondition: // Length of deck == DECK_SIZE // && numberOfShuffles is assigned // Postcondition: // The order of components in the deck has been // rearranged numberOfShuffles times, randomly void Recreate( /* inout */ CardPile& pile1, /* inout */ CardPile& pile2 ); // Gathers cards from two piles and puts them back into deck // Precondition: // Length of deck == 0 // && (Length of pile1 + length of pile2) == DECK_SIZE // Postcondition: // Deck is the list consisting of all cards from // pile1@entry followed by all cards from pile2@entry // && Length of deck == DECK_SIZE // && Length of pile1 == 0 && Length of pile2 == 0 CardDeck(); // Postcondition: // List of DECK_SIZE components is created // representing a standard deck of playing cards // && Cards are in order by suit and by rank private: void Merge( CardPile&, CardPile& ); }; #endif