Although a subclass includes all of the members of its superclass, it cannot access those members of the superclass that have been declared as private. In a class hierarchy, private members remain private to their class. This program contains an error and will not compile. A's j is not accessible here. Since j is declared as private, it is only accessible by other members of its own class.
Subclasses have no access to it.
A class member that has been declared as private will remain private to its class. It is not accessible by any code outside its class, including subclasses. Let's look at a more practical example that will help illustrate the power of inheritance. Here, the final version of the Box class developed in the preceding chapter will be extended to include a fourth component called weight. Thus, the new class will contain a box's width, height, depth, and weight.