Inheiritance and derived classes
I have a question on derived classes and the inheiritance designation. In a documnet I have it says about derivation: "Access to inheirited members by derived classes and friends of
the derived class is independent of the base-class inheiritance designation."
I took this to mean that it does not matter if the base-class inheiritance designation is public, private, or protected as far as the ability of the derived class to access nheirited
I was testing this out with some code. I made a BaseClass that had a public, protected, and private int member, along with methods to get and set each int member. I then established a
publicly dervived class(DerivedPublic) of the base class. I added no more members to the derived class. When I instantiated an object of type DerivedPublic, I found that I could access each int member through the get method. This made sense.
I then establishd a protected derivived class(DerivedProtected) of the base class. I added no more members to the derived class. When I instantiated an object of type DerivedProtected, I found that I could not access ANY int member through the get
method. I don't understand why I could not do this. Based on what the document said, I thought I would be able to access the int data members.