Difference between revisions of "PrF UG classes replace superclass"
(5 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
== Replacing a Superclass == | == Replacing a Superclass == | ||
− | {{PrF_UG_TOC_classes}}<div id='prf_ug'> | + | <noinclude>{{PrF_UG_TOC_classes}}<div id='prf_ug'></noinclude> |
You can move a class to a different superclass, | You can move a class to a different superclass, | ||
Line 48: | Line 48: | ||
<ol class='a'> | <ol class='a'> | ||
<li><p> | <li><p> | ||
− | Highlight <b>Columnist</b> in the | + | Highlight <b>Columnist</b> |
− | + | in the [[PrF_UG_classes_class_browser|Class Browser]]. | |
Because <b>Columnist</b> has more than one superclass, | Because <b>Columnist</b> has more than one superclass, | ||
you must make sure to select the copy of <b>Columnist</b> | you must make sure to select the copy of <b>Columnist</b> | ||
Line 57: | Line 57: | ||
See [[PrF_UG_classes_jump_to_superclass|Jumping to a Different Superclass]] | See [[PrF_UG_classes_jump_to_superclass|Jumping to a Different Superclass]] | ||
for more information.) | for more information.) | ||
− | Note that the [[PrF_UG_classes_template_slot_pane|Template Slots | + | Note that the [[PrF_UG_classes_template_slot_pane|Template Slots pane]] |
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, "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, "Person" outlined, "Columnist" selected]]</div> | ||
</ol> | </ol> | ||
Line 82: | Line 84: | ||
These were the slots it inherited from <b>Employee</b>. | These were the slots it inherited from <b>Employee</b>. | ||
− | <div>[[Image:PrF_UG_classes_superclass_drag_3.png| | + | <div>[[Image:PrF_UG_classes_superclass_drag_3.png|frame|none| |
+ | Class Browser, "Columnist" selected, some slots missing]]</div> | ||
− | </div> | + | |
+ | <noinclude></div></noinclude> |
Latest revision as of 16:38, November 13, 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.