I'm getting an error 'Expected class name' from my child class header file. After searching through stackoverflow, I tried to declare the base class in the child class header file and it works. However, I want to have it in a separate file...
child class [RefCard.h]
#ifndef RefCard_h
#define RefCard_h
#include <stdio.h>
#include "Cards.h"
class RefCard : public Cards
{
public:
RefCard();
};
#endif /* RefCard_h */
I get the error message for the line 'class RefCard : public Card'
If I add the line class Cards{};
right before class RefCard:public Cards
it works, but that's not what I want to do.
Class Cards is properly defined in Cards.h and implemented in Cards.cpp I guess there is an issue in the linking?
Cards.h
#ifndef Cards_h
#define Cards_h
#include <string>
#include "RefCard.h"
#include "RoleCard.h"
#include "PlayerCard.h"
class Cards{
private:
std::string card_name;
std::string card_textf;
std::string card_textb;
public:
Cards();
};
#endif /* Cards_h */
Cards.cpp
#include <stdio.h>
#include <iostream>
#include "Cards.h"
Cards::Cards(){
card_name="";
card_textf="";
card_textb="";
}