I'm confused on how private variables are inherited and I'm getting errors telling my variable's are private when I try to use them in inherited classes.
A bare-bones example.
Let's say:
//dog.h
class dog
{
private:
bool fluffy;
public:
...
};
And let's say:
//dog.cpp
#include "dog.h"
...
Now:
//shepard.h
#include "dog.h"
class shepard: public dog
{
private:
...
public:
void groom();
};
And:
//shepard.cpp
#include "shepard.h"
void shepard::groom()
{
fluffy = false;
}
If I try to use the groom function I get an error something like:
error: 'bool dog::fluffy' is private
What am I doing wrong? Optional: What's the best way to design this solution in the future?