APLX Help : Help on APL language : System Methods : ⎕BASE Base (parent) class
|
|
![]() |
|
Implemented for Internal and External classes. Not implemented for System classes. Syntax:
The niladic system method )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
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] |
|
APLX Help : Help on APL language : System Methods : ⎕BASE Base (parent) class
|
Copyright © 1996-2010 MicroAPL Ltd