1 #ifndef CARDSTACK_INCLUDED 2 #define CARDSTACK_INCLUDED 3 4 #define MAX_CARDSTACK_SIZE 128 5 6 class CardStack 7 { 8 friend class CardRegion; 9 10 public: CardStack()11 CardStack() : nNumCards(0) { } 12 13 void NewDeck(); NumCards()14 int NumCards() const { return nNumCards; } 15 void Shuffle(); 16 void Clear(); 17 void Reverse(); 18 19 void Push(const Card card); 20 void Push(const CardStack &cardstack); 21 22 Card Pop(); 23 CardStack Pop(int items); 24 25 Card Top(); 26 CardStack Top(int items); 27 28 void Print(); 29 30 Card RemoveCard(size_t index); 31 void InsertCard(size_t index, Card card); 32 33 //subscript capability!! 34 Card & operator[] (size_t index); 35 const Card & operator[] (size_t index) const; 36 37 CardStack &operator += (Card card); 38 CardStack &operator += (CardStack &cs); 39 40 CardStack operator + (Card card); 41 CardStack operator + (CardStack &cs); 42 43 private: 44 45 CardStack(CardStack ©this, size_t fromindex); 46 47 Card cardlist[MAX_CARDSTACK_SIZE]; 48 int nNumCards; 49 }; 50 51 #endif /* CARDSTACK_INCLUDED */ 52 53