Collection parts stored in the z/TPF database
In object-oriented design, objects that are unrelated to each other
in terms of inheritance are often grouped together to represent other
objects. This practice of grouping objects together for this purpose
is commonly known as object aggregation. Object aggregation
is a way in which objects of different classes relate to one another
and has nothing to do with class inheritance. You can best understand
object aggregation by considering how it can serve to design another
database used to store vehicle information. Consider the following
example, which shows how objects of the Automobile class relate to
objects of various different classes even though none of these classes
may be related in terms of inheritance. Even though the Automobile
class defines a whole set of attributes that are inherited by objects
belonging to this class, other objects might be needed in addition
to these attributes to represent a real automobile. Some, but not
all, of these objects are shown in the following figure:
To represent an actual automobile in our database in greater detail, we use an Automobile object to store some generic attributes about the automobile as well as a whole series of other objects such as Wheel objects, an Engine object, a Dashboard object, and so on. All of these objects, including the Automobile object itself, are considered as parts of a greater whole that represents an actual automobile.