I am trying to make a class representing a card. but i faced this error while compiling.
error: expected `;' before "suit".
Can anyone help what is problem with this code?
#include<string>
using namespace std;
class Card {
private:
Card::Suit suit;
Card::CardName cardName;
public:
enum Suit {Clubs, Diamonds, Hearts, Spades, UNKNOWN_SUIT};
enum CardName {Ace, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, UNKNOWN_CARDNAME};
class NotInitalised : public exception{};
Card ();
Card (int card);
Card (Card::Suit s, Card::CardName n);
void setCard(Card::Suit, Card::CardName);
Card::Suit getSuit();
Card::CardName getCardName();
Card::CardName getCardName(int);
int getCardValue();
string toString();
};
using namespace std;in a header file right now. the potential side effects are not worth the convenience (and there is no convenience). Use namespace-qualified ids/types in your headers. (ex.std::string)