## )REPARENT class parent

)REPARENT allows you to change the parent of an internal (user-defined) class.

The first argument is the name of the class which you want to re-parent. The second is the name of the class which will be the new parent.

Other than the restriction that the new parent class must not be descended from the class you are modifying, there is nothing to prevent you from re-parenting a class arbitrarily. However, the main use for )REPARENT is for inserting an extra level into the class hierarchy. For example, if you have a class `Car` which inherits from `Vehicle`, you might want to create a new class `MotorVehicle` which inherits from `Vehicle`, and re-parent `Car` so that it now inherits from `MotorVehicle`:

          )CLASSES
    Car     MotorVehicle    Vehicle
          ŚCLASS Car
    {Car} {Vehicle}
          ŚCLASS MotorVehicle
    {MotorVehicle} {Vehicle}
          )REPARENT Car MotorVehicle
          ŚCLASS Car
    {Car} {MotorVehicle} {Vehicle}

Any existing instances of the class will be unaffected except that any properties which are not valid in the new version of the class (because they were inherited from the old parent but are not inherited from the new parent) will be lost.

You can also re-parent a class using the ŚREPARENT system function, or by using the Class Editor (select Reparent Class.. from the File menu).

Topic: APLX Help : Help on APL language : System Commands : )REPARENT Reparent class

[ Previous | Next | Contents | Index ]