This is saying that it can't access its own inherited members if they were private in the base class?
Generally private members are not susposed to be accessible from "outside".
It's considered good habbit to keep all member-variables private and provide public getter- & setter-methods instead:
class Name
{
private:
String mForename;
String mSurName;
public:
String getForename()
{
return mForename;
}
void setForename(String name)
{
mForename= name;
}
String getSurname()
{
return mSurname;
}
void setSurname(String name)
{
mSurname= name;
}
};This might look long-winded but makes your code much more maintainable.
A drawback of this approach is that any returned object gets copied.
This can noticeably hurt performance when dealing with complex objects.
Instead you can return a reference (which is essentially a pointer just without the related syntax) and additionally make it constant so the caller can't change it:
...
const String& getSurname()
{
return mSurname;
}
(this is unnecessary for "simple" data-types)
Generally it's advisable that each class completely manages its' own members, so it's rarely required to poke inherited data.