Hello NG,
Regarding access-declarations and member using-declarations as used to
change the access level of an inherited base member...
Two things need to be considered when determining an inherited base member's
access level in the derived class: its access level in the base class and
the type of inheritance (public, protected, or private). After this
determination is made, the following possibilities exist for manually
changing the access level, in the derived class, of the inherited base
member as long as it is not inaccessible in the derived class:
1. It can be set no higher than what it was in the base
2. It can be set only to exactly what it was in the base
3. It can be set to anything
If it *is* inaccessible in the derived class, it must remain so.
I have seen statements in published books that 1 is the case. I have also
seen statements in published books that 2 is the case. Empirically, I have
observed that 3 is the case (as the results below indicate). Can somebody
please confirm that 3 is indeed what's permitted by the language?
Thanks,
Dave
Access level in base: inaccessible
Type of inheritance: public
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: private
Type of inheritance: public
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: protected
Type of inheritance: public
Resulting access level in derived: protected
Access level in derived can be raised to: public
Access level in derived can be lowered to: private
Access level in base: public
Type of inheritance: public
Resulting access level in derived: public
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: private, protected
Access level in base: inaccessible
Type of inheritance: protected
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: private
Type of inheritance: protected
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: protected
Type of inheritance: protected
Resulting access level in derived: protected
Access level in derived can be raised to: public
Access level in derived can be lowered to: private
Access level in base: public
Type of inheritance: protected
Resulting access level in derived: protected
Access level in derived can be raised to: public
Access level in derived can be lowered to: private
Access level in base: inaccessible
Type of inheritance: private
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: private
Type of inheritance: private
Resulting access level in derived: inaccessible
Access level in derived can be raised to: <None>
Access level in derived can be lowered to: <None>
Access level in base: protected
Type of inheritance: private
Resulting access level in derived: private
Access level in derived can be raised to: public, protected
Access level in derived can be lowered to: <None>
Access level in base: public
Type of inheritance: private
Resulting access level in derived: private
Access level in derived can be raised to: public, protected
Access level in derived can be lowered to: <None>