This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!

Card.h

By: Ollii on Dec 14th, 2012  |  syntax: C++  |  size: 0.93 KB  |  views: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. /*
  2.  * Card.h
  3.  *
  4.  *  Created on: 13 dec. 2012
  5.  *      Author: olivier
  6.  */
  7.  
  8. #ifndef CARD_H_
  9. #define CARD_H_
  10.  
  11. #include <iostream>
  12.  
  13. enum ESuit { Heart, Diamond, Club, Spade };
  14. enum  EValue { _2 = 2, _3, _4, _5, _6, _7, _8, _9, _10, J, Q, K, A };
  15.  
  16. class Card {
  17. public:
  18.         Card();
  19.         Card(ESuit, EValue);
  20.         virtual ~Card();
  21.  
  22.         ESuit getSuit() const;
  23.         EValue getValue() const;
  24.  
  25.         friend bool operator==(Card&,Card&);
  26.         friend bool operator!=(Card&,Card&);
  27.         friend bool operator<(Card&,Card&);
  28.         friend bool operator>(Card&,Card&);
  29.         friend std::ostream& operator<<(std::ostream&, Card&);
  30.  
  31. protected:
  32.         EValue fValue;
  33.         ESuit fSuit;
  34. };
  35.  
  36. class HeartCard: public Card  {
  37. public:
  38.         HeartCard(EValue);
  39. };
  40.  
  41. class DiamondCard: public Card  {
  42. public:
  43.         DiamondCard(EValue);
  44. };
  45.  
  46. class ClubCard: public Card  {
  47. public:
  48.         ClubCard(EValue);
  49. };
  50.  
  51. class SpadeCard: public Card  {
  52. public:
  53.         SpadeCard(EValue);
  54. };
  55.  
  56. #endif /* CARD_H_ */
clone this paste RAW Paste Data