I feel like a complete idiot. Im trying to get a structure in my class which is a deck and I want a pointer to the deck which I can use throughout the class. Please point me in the right direction. Is my syntax way off?
Code:
#ifndef DECK_H_CLASS_01
#define DECK_H_CLASS_01
/*===================Card Structure===================*/
struct card
{
int value; //card value
int suit; //card suit
bool dealt; //is it dealt?
card (int v, int s, bool d); //default constructor
};
card::card (int v, int s, bool d)
: value(v), suit(s), dealt(d) { }
/*====================================================*/
const int deckSize = 52; //standard deck size
class deck
{
public:
deck (); //default constructor
void shuffle (); //shuffle the deck
void deal (card); //mark a card dealt
~deck (); //default desctructor
private:
struct myDeck //deck with 52 cards
{
card deckCards[deckSize];
} *standardDeck; //pointer to the deck
};
deck::deck ()
{
for (int suit = 1; suit <= 4; suit++)
{
for (int a = 1; a <= 13; a++)
{
standardDeck->deckCards[a-1].value = a;
standardDeck->deckCards[a-1].suit = suit;
standardDeck->deckCards[a-1].dealt = false;
}
}
}
void deck::shuffle ()
{
}
void deck::deal (card)
{
}
deck::~deck ()
{
}
#endif