Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enum question

Status
Not open for further replies.

joenching

Programmer
Apr 30, 2005
2
0
0
US
I am going to write an enumerated type that identifies the suit of the jail cell. However, it should be from another class - Card.

I tried to code it like that
Code:

enum card::suit; //an enumerated type (located in the Card ADT) that identifies the suit of the jail cell



I think it is not going to work, can anyone gives me some suggest?

Here is the code from card.h
Code:

#include <iostream>

using namespace std;

class Card
{
public:

enum Rank
{
ACE,
TWO,
THREE,
FOUR,
FIVE,
SIX,
SEVEN,
EIGHT,
NINE,
TEN,
JACK,
QUEEN,
KING
};

enum Suit
{
SPADES,
HEARTS,
CLUBS,
DIAMONDS
};

Card(); // Default constructor will initialize to Ace of Spades
Card( Rank newRank, Suit newSuit );

Rank getRank() const {return rank;}
Suit getSuit() const {return suit;}

void setRank( Rank newRank );
void setSuit( Suit newSuit );

private:

Rank rank;
Suit suit;
};

ostream& operator<<( ostream& os, const Card& card );



appericate it.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top