I am writing a poker program where I have a Deck class class and a Hand class. The Hand class inherits from the Deck class, so it can use its printGroup method. However, when compiling, I get an error message:
expected class-name before '{' token
referring to the line:
class Hand : public Deck{
Here is the code for the two class headers. Can someone help me solve this problem?
// Header Title
#ifndef HAND_H
#define HAND_H
#include <iostream>
#include <vector>
#include "Deck.h"
#include "Card.h"
class Card;
class Hand : public Deck{
public:
Hand(){}
void createHand(std::vector<Card> &, std::vector<Card> &);
};
#endif
// deck header
#ifndef DECK_H
#define DECK_H
#include <iostream>
#include <vector>
#include "Card.h"
class Card;
class Deck{
public:
Deck(){}
void createDeck(std::vector<Card> &);
void printGroup(std::vector<Card> &, int);
void sortDeck(std::vector<Card> &, int, int);
};
#endif
source
share