#ifndef B_H
#define B_H
#include "A.h"
class B : public A
{
public:
B();
void set_bar(int new_bar);
int get_bar() const;
void print() const;
private:
char foo;
int bar;
};
#endif
If you're using A's set_foo() then you're setting A's char foo, not B's. B's char foo you're setting in B::B() : foo('f'), bar(1) {}, defaulting it to f.
First step is pointless. You provide accessors in A. (but yeah, you could avoid those accessors by making the variable public)
Third step, ¿what's the difference? and you should let 'A' handle 'A' members (its constructor already take care of that)