NCL Home > Documentation > HLUs > User Guide

Composite classes

Composite classes are classes that incorporate the functionality of other classes that are not directly in their class hierarchy. One of the primary considerations in favor of using the object-oriented paradigm in software development is that once a class has been created, all of the functionality of that class can be used in another class. This results in the elimination of much repeated code.

For example, to create a complete plot of variable X versus variable Y, one may need a set of X axis, Y axis, and main titles, a tick-marked set of axes with scale labels, and the curve of X versus Y. To create a contour plot of a 2-D temperature array, you still need the set of titles and the tick-marked axes with scale labels. So we created a Title class and a TickMark class which can then be incorporated into the higher level View classes such as XyPlot, ContourPlot, VectorPlot, and StreamlinePlot. Not only does this reduce the amount of code, it also ensures consistency in how things are done and how things work. Such consistency is extremely valuable for the implementation of Graphical User Interfaces.

Objects created from composite classes have all the resources of their class, their superclasses, and their composite member classes.

The composite class members of a class are shown on the diagram of class hierarchies; click on any class in a colored box.

See also: