## ŒBASE Base (parent) class

Implemented for Internal and External classes. Not implemented for System classes.

Syntax:

classref „ objref.ŒBASE
classref „ classref.ŒBASE
classref „ ŒBASE (Within user-defined method, same as ŒTHIS.ŒBASE)

The niladic system method ŒBASE returns a reference to the base (parent class) of either an object, or a class. The result is always a class reference, or the Null object if there is no parent. For example, if class `Car` inherits from class `Vehicle`:

          )CLASSES
    Car     Vehicle
          M„ŒNEW 'Car'
          M
    [Car]
          M.ŒCLASSREF
    {Car}
          M.ŒBASE
    {Vehicle}

          M.ŒNL 2        © Child has properties of its own, plus those of parent
    Marque
    Owner
    HasEngine
    IsPublicTransport
    Passengers
    TopSpeed
    Wheels

          M.ŒBASE.ŒNL 2  © Parent has fewer properties than the child
    HasEngine
    IsPublicTransport
    Passengers
    TopSpeed
    Wheels

A common use for ŒBASE is calling the parent's version of a method within the child's version of the same method. Typically, the need for this arises when the child class needs to do some extra processing in addition to what the parent does. You have full control over this; the child method (which in APLX always overrides the parent's method) can call the parent's version either at the beginning, in the middle, or at the end of its own version of the method - or indeed, not call it at all.

ŒBASE can also be used with External classes (but not System classes). For example, in the .Net System.Windows.Forms framework, the Button class inherits from the ButtonBase class, which in turn inherits from the Control class:

          BT„'.net' ŒNEW 'System.Windows.Forms.Button'
          BT.ŒBASE
    {.net:ButtonBase}
          BT.ŒBASE.ŒCLASSNAME
    .net:System.Windows.Forms.ButtonBase
          BT.ŒBASE.ŒBASE.ŒCLASSNAME
    .net:System.Windows.Forms.Control

Similarly, in Ruby, the DateTime Class inherits from the Date class, which in turn inherits from the fundamental Object class (from which all classes in Ruby are derived). This example shows how this looks from within APL:

          'ruby' ŒSETUP 'require' 'date'
          DT„'ruby' ŒNEW 'DateTime'
          DT                             © Reference to a DateTime object
    [ruby:DateTime]
          DT.ŒBASE                       © Reference to parent class (Date)
    {ruby:Date}
          DT.ŒBASE.ŒCLASSNAME
    ruby:Date
          DT.ŒBASE.ŒBASE.ŒCLASSNAME
    ruby:Object
          DT.ŒBASE.ŒBASE.ŒBASE
    [NULL OBJECT]

Topic: APLX Help : Help on APL language : System Methods : ŒBASE Base (parent) class

[ Next | Contents | Index ]