|
|
Another useful quality of object classes is that you can specify that objects of one class can contain those of another class. The containing class also known as the superior class, and the contained class is known as the subordinate class. An example of this is partitions contained in a hard disk. The object API allows you to use this capability through the scope option, where the operation is performed not on the object specified, but on the objects that it contains.
One use of containment is to create a class whose only purpose is to contain all objects of another class. This is useful if you want to get a list of all objects in that class, or to filter those objects by some criteria.
The containment editing dialog is accessible from the Containment... button on the Edit Class screen.
Containment screen
You can pick one class from the combo box to be your containing (superior) class. The contained class list contains all the classes in the class definition file. Only the ones that are highlighted are contained by the current class. Currently, the OSA builder does not check whether containment specifications match up with each other, so you need to ensure that if class A names B as a contained class, class B names class A as a containing class.
``Containment screen''
shows a containing class named sco UUCPsystems
to contain all objects of the UUCPsystems class
. This
class does not have to have anything specified for it except for the
containment. We then need to modify UUCPsystems
so that it is
contained by our new class.