< Day Day Up > |
7.1 Extending ImageViewer's CapabilitiesRecall from Chapter 5 the list of possible functional requirements for our ImageViewer class:
The ImageViewer class already implements the first five requirements, but it stops there. In the ImageViewerDeluxe class, we'll add the next two items on the list: the abilities to reposition and resize the viewer. It's important to note that those features could easily have been added directly to the ImageViewer class. For the sake of this example, we'll presume that we don't have access to the ImageViewer source code, perhaps because it's a commercial component that isn't open source. In other words, in this case we're using inheritance out of faux necessity, not because it necessarily provides the best design. This often happens when working with standard class libraries and components . In Part III, we'll study more complex interclass relationships, in which inheritance is a matter of choice rather than circumstance. |
< Day Day Up > |