APLX Help : Help on APL language : System Functions & Variables : ⎕INSTANCES Instances of a Class or Descendants
|
|
|
|
|
The monadic or dyadic system function 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
|
|
APLX Help : Help on APL language : System Functions & Variables : ⎕INSTANCES Instances of a Class or Descendants
|
|
Copyright © 1996-2010 MicroAPL Ltd