Difference between revisions of "PrF UG inst showing subclass instances"
Line 40: | Line 40: | ||
<div>[[Image:PrF_UG_inst_show_direct_instances.png|frame|none| | <div>[[Image:PrF_UG_inst_show_direct_instances.png|frame|none| | ||
− | Instance Window]]</div> | + | Instance Window, "Jane" selected]]</div> |
You can change this, using the Instance Menu. | You can change this, using the Instance Menu. |
Revision as of 03:43, October 23, 2008
Showing Subclass Instances
The Instance Menu at the top of the Instance Browser allows you to choose the level of instances - direct instances or subclass instances - you want to see for a selected class. These choices are also available when you are choosing instances in a dialog box.
About Subclass Instances
There are two types of instances subordinate to a class:
A direct instance is an instance that has been created directly under the class.
A subclass instance is any instance that is subordinate to the class. Because of inheritance, an instance of a class is also an instance of all of that class's superclasses. Therefore, an instance can be an instance of many classes of which it is not a direct instance.
In the newspaper example, the Manager class has three direct instances: Jane, Joe, and Mary. The Manager class also has a subclass, Director, which has a direct instance Tim. Tim is a subclass instance of Manager.
Showing Subclass Instances
By default, the Instance Window shows only the direct instances for a class.
You can change this, using the Instance Menu. To show all instances for a class, including subclass instances:
Select Show Subclass Instances from the Instance Menu at the top of the Instance Browser, to the right of the instance buttons. The display will change to show all instances subordinate to the class. The class for which the instance was created is shown in parentheses after the instance name.
Notes:
It is possible to attach an instance to more than one class (see Adding a Class Type to an Instance), so that the instance appears directly under two or more classes. In this case, the class name displayed after the instance will be the class where the instance was first created.
By definition, abstract classes cannot have direct instances, but they can have subclass instances. This selection allows you to see all the subclass instances for an abstract class.
Showing Direct Instances Only
If subclass instances are shown, you can choose to show only direct instances.
Click on the the Instance Menu at the top of the Instance Browser, to the right of the instance buttons. You will see that Show Subclass Instances is checked.
Select Show Subclass Instances from the menu to deselect this setting and show only direct instances.