A derived class inherits each member of its foundations. Full stop. You cannot selectively inherit parts of a base class.
Creating a private variable does not prevent inheritance. The variable still exists, but under normal circumstances it is not available. With various friendship games you can make it accessible. Perhaps part of the confusion here is caused by Java, where private members are not inherited. I.e
struct Base { private: int i; }; struct Derived : Base { }; Derived d; di = 3;
If i not inherited, the error would be that d does not have a member named i .
EDIT: another, perhaps more meaningful example
void f(); class Base { void f(); }; class Derived : Base { void g() { f();
With Java rules, calling f() will be fine and will call global f() .
Pete becker
source share