## ŒINSTANCES Instances of a Class or Descendants

The monadic or dyadic system function ŒINSTANCES returns a vector of references to all the instances of a given internal class. The right argument is either a class reference, or a character vector containing the name of an internal class.

If the left argument is omitted, or is 0, the list will include instances of the specified class and of any descendants of the class. If the left argument is 1, the list will be restricted to instances of the specified class itself only.

In this example, classes `Rectangle` and `Triangle` both inherit from class `Polygon`:

          )CLASSES
    Polygon Rectangle       Triangle
          T1„ŒNEW 'Triangle'  ª T1.ŒDF 'Triangle1'

          T2„ŒNEW 'Triangle'  ª T2.ŒDF 'Triangle2'

          P1„ŒNEW 'Polygon'  ª P1.ŒDF 'Polygon1'

          R1„ŒNEW 'Rectangle'  ª R1.ŒDF 'Rectangle1'

          ŒINSTANCES 'Polygon'    © Form using class name as right arg
    Triangle1 Triangle2 Polygon1 Rectangle1
          0 ŒINSTANCES Polygon    © Form using class reference as right arg
    Triangle1 Triangle2 Polygon1 Rectangle1
          1 ŒINSTANCES Polygon
    Polygon1

ŒINSTANCES cannot be used to find instances of external classes.

Topic: APLX Help : Help on APL language : System Functions & Variables : ŒINSTANCES Instances of a Class or Descendants

[ Previous | Next | Contents | Index ]