Difference between revisions of "PrF UG classes replace superclass"
Line 60: | Line 60: | ||
for <b>Columnist</b> includes slots it inherits from <b>Employee</b>. | for <b>Columnist</b> includes slots it inherits from <b>Employee</b>. | ||
</p> | </p> | ||
− | <div>[[Image:PrF_UG_classes_superclass_drag_1.png| | + | <div>[[Image:PrF_UG_classes_superclass_drag_1.png|frame|none| |
+ | Class Browser with Columnist selected]]</div> | ||
<li><p> | <li><p> | ||
Line 75: | Line 76: | ||
will be moved from the original superclass to the new superclass. | will be moved from the original superclass to the new superclass. | ||
</p> | </p> | ||
− | <div>[[Image:PrF_UG_classes_superclass_drag_2.png| | + | <div>[[Image:PrF_UG_classes_superclass_drag_2.png|frame|none| |
+ | Class Browser with Person outlined]]</div> | ||
</ol> | </ol> | ||
Line 83: | Line 85: | ||
<div>[[Image:PrF_UG_classes_superclass_drag_3.png|frame|none| | <div>[[Image:PrF_UG_classes_superclass_drag_3.png|frame|none| | ||
− | Class Browser with | + | Class Browser with slots missing]]</div> |
</div> | </div> |
Revision as of 12:10, October 20, 2008
Replacing a Superclass
You can move a class to a different superclass, using drag-and-drop in the Class Browser. This will remove the class from one superclass and make it a subclass of another superclass. Note that when you replace the superclass of a class, the class will often lose and gain inherited slots.
Moving a Class
To move a class:
Select the class you want to move. If the class has more than one superclass, select the view of the class that appears under the superclass you want to replace.
Hold down the mouse button and drag the class on top of the new superclass.
Release the mouse. The subclass will no longer be under the original superclass, but will now be located under the new superclass. Note that the slots of the moved class will automatically change to reflect the inheritance from its new superclass.
You can also add a superclass by holding down the Ctrl (Cmd) key while you drag.
Example
The following example shows how to make Columnist inherit from Employee, rather than the class Person.
Highlight Columnist in the Class Browser. Because Columnist has more than one superclass, you must make sure to select the copy of Columnist that is under Employee. (When a class has more than one superclass, you can use the Superclasses pane to select the copy that you want. See Jumping to a Different Superclass for more information.) Note that the Template Slots Pane for Columnist includes slots it inherits from Employee.
Hold down the mouse button and drag Columnist on top of the new superclass Person.
Release the mouse button to drop the class. Person is outlined and the Class Browser redisplays to show the new hierarchy. The dragged class and all of its subclasses, if any, will be moved from the original superclass to the new superclass.
If you highlight Columnist after it has been repositioned, you will see that some of the slots it had before are now missing. These were the slots it inherited from Employee.