// cppHearts, Copyright 2001 Michael W. Godfrey, email: migod@uwaterloo.ca // See copyright.txt for details. #ifndef _CARD_H_ #define _CARD_H_ #include class Card { public: // Some (static) constants and types for rank and suit. enum Suit {Spades, Diamonds, Clubs, Hearts}; static const string SuitName[] ; static const int numSuits; enum Rank {Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace}; static const string RankName[]; static const int numRanks; static const int numCards; // Constructor and destructor. // We have to place them here after the static type decls in order // to be able to use them! Usually we list constructors and // destructors first. // Note that this is one of those bizarre cases where it makes no // sense to have a default constructor of no args. Card (Suit s, Rank r) : suit(s), rank(r) {}; ~Card () {}; // Accessor fcns virtual Rank getRank () const; virtual Suit getSuit () const; virtual int heartsValue () const; // Overloaded operators friend ostream & operator << (ostream &out, const Card &c); bool operator == (const Card &otherCard); private: Suit suit; Rank rank; }; #endif