-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.h
52 lines (36 loc) · 1.4 KB
/
card.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/// File: card.h
/// This class is responsible for creating and managing Cards and outputting them.
///
#ifndef CARD_H
#define CARD_H
#include <iostream>
using namespace std;
/// Enumerated type of Suit for the Card object.
enum Suit {CLUBS, DIAMONDS, HEARTS, SPADES};
/// Enumerated type of Rank for the Card object.
enum Rank {TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE};
class Card {
public:
/// No argument constructor.
Card();
/// Constructor that sets the rank and suit for a Card object.
Card(Rank rank, Suit suit);
/// Constructor that sets the rank and suit for a Card object from an input string.
Card(string input);
/// Destructor – does nothing as no objects are created dynamically by the constructor of this class.
~Card();
/// Accessor for the Rank instance variable.
Rank getRank() const;
/// Accessor for the Suit instance variable.
Suit getSuit() const;
/// Overloads the function operator to provide a comparison which sets an ordering between two Card objects.
bool operator()(Card* card1, Card* card2);
/// Puts a string representation of this Card on the output stream.
friend ostream& operator<<(ostream& out, const Card& card);
private:
/// Suit variable for the Card object.
Suit suit;
/// Rank variable for the Card object.
Rank rank;
};
#endif // CARD_H