i'm working on a project to make a simple blackjack game. so far i am at the point where i should be testing out my card class to see if it's working and everything. i have 3 files, card.h:
Code:
enum cardsuit {HEARTS, DIAMONDS, CLUBS, SPADES};
class card
{
public:
card();
void Set_Card(int);
void Display();
int Card_Value();
void Swap_Card(card);
private:
string description;
int value;
cardsuit suit;
};
then there's card.cpp which has all the function def's:
Code:
#include <iostream>
#include <string>
#include "card.h"
using namespace std;
card::card()
{
// initialize card
}
int card::Card_Value()
{
return value;
}
void card::Display()
{
// display card info
}
void card::Set_Card(int num)
{
// set the card depending on the num
}
void card::Swap_Card(card new_card)
{
// swap current card with the new_card
}
and then my main program so far just tests out the linkage and the display function:
Code:
#include <iostream>
#include <string>
#include "card.h"
using namespace std;
int main()
{
card cardobject;
cardobject.Display();
cin.get();
return 0;
}
i'm using Dev-Cpp and it tells me "string is used as a type but is not defined as a type" in my card.h file. then it says undeclared variable whenever i try to use the "description" variable... any thoughts? what do i have to do to be able to declare a string variable in a class in a header file? thanks for the help