protect data member of public base class

Is there a way to protect a data member of a public base class from use by users of the derived class? Some of the data members of the base should be publicly accessible but not all. Thanks for your attention.

John Boncek
Is there a reason you cannot make the data members private?
Keep in mind there isn't just public and private, maybe setting some of the data as protected would help? http://www.cplusplus.com/doc/tutorial/classes/
The base class is from a package I cannot modify.

John Boncek
So you have an exposed base class that you need to restrict derived class access to certain data members, but you cannot modify the code of the base class? So you're screwed then. You need to change this at the base.
Last edited on
Or wrap it in a wrapper.
Now there's an idea, a derived class from the base that copies the data members into private versions of the same thing. Someone give rapidcoder a cookie! That was pretty good!
Topic archived. No new replies allowed.