#ifndef B_H
#define B_H
#include <string> // to be used here, so we need to include it
// not "using namespace std;" here!! *
class B
{
public:
std::string s;
float f;
int i;
bool b;
B();
void setValues();
std::string printValues(); // don't miss that std::
};
#endif
#ifndef S_H
#define S_H
#include "B.h" // required to make B known here
#include <string> // known through B, but better safe than sorry
class S : public B
{
public:
S(std::string name);
std::string subPrint(); // ***
protected:
std::string s2;
};
#endif
You forgot to qualify some of your implementations with the name of the class - e.g. B::printValues and S::subPrint - thus the compiler sees them as global functions instead of member functions.