You can fine tune the exposure from inheritance down to individual members. Listing 4 demonstrates how to control the exposure of individual members.
Listing 4: | individualmember |
In this example, class B hides everything that it inherits from class A. However, it reexposes member i of class A as a public member of B.
Class C reexposes everything that it inherits from class A, to the degree that class A permits. However, it hides member j from class A from subclasses and the public.
This method reexposes or hides certain members as exceptions to the class inheritance exposure restriction. As a result, a subclass has very fine control over what members to hide from everyone (private), hide from the public (protected) or reexpose to everyone (public).