#ifndef _CARD_H #define _CARD_H //**************************************************************************** // File: Card.h // Author: Dr. Thomas C. Bressoud // Date: February 8, 2008 // Class: CS 173-01, Professor Bressoud // Purpose: Interface file for the Card class, defining a single card with a // domain consisting of a rank and a suit. Operations include // creation and acessing rank and suit. // Input: NA // Output: NA //**************************************************************************** #include using namespace std; class Card { public: //-------------------------------------------------------------------------- // Enumeration available without an object instance // enum Suit {SPADES, HEARTS, DIAMONDS, CLUBS, NUMSUIT}; //-------------------------------------------------------------------------- // Constructor(s) // Card(); // Create default ace of spades Card(int rank, Suit s); // Create card with given rank and suit //-------------------------------------------------------------------------- // Accessor functions // int getRank() const; // return rank 1..13 of instance Suit getSuit() const; // return suit for this instance //-------------------------------------------------------------------------- // Print/String functions // void print() const; // print (to std out) rep of card string toString() const; // return string rep of card private: //-------------------------------------------------------------------------- // Domain includes rank and suit for each card instance // int myRank; // rank in {1..13} for this card Suit mySuit; // suit in {spades, hearts, diamonds, clubs} for card //-------------------------------------------------------------------------- // Private utility functions used within class // string suitString(Suit s) const; // return "spades", "hearts", ... string rankString(int r) const; // return "ace", "two", ... }; // class Card #endif