Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
When you extend a class, the new class inherits the superclass’s members—though the private superclass members are hidden in the new class. You can customize the new class to meet your needs by including additional members and by overriding superclass members. Doing this does not require the subclass programmer to change (or even have access to) the superclass’s source code. Java simply requires access to the superclass’s .class file so it can compile and execute any program that uses or extends the superclass. This powerful capability is attractive to independent software vendors (ISVs), who can develop proprietary classes for sale or license and make them available to users in bytecode format. Users then can derive new classes from these library classes rapidly and without accessing the ISVs’ proprietary source code.
Software Engineering Observation 9.7
|
| Although inheriting from a class does not require access to the class’s source code, developers often insist on seeing the source code to understand how the class is implemented. Developers in industry want to ensure that they’re extending a solid class—for example, a class that performs well and is implemented robustly and securely. |