Implemented for Internal and External classes. Not implemented for System classes.
Syntax:
classref „ objref.ŚCLASSREF
classref „ classref.ŚCLASSREF
classref „ ŚCLASSREF (Within user-defined method, same as ŚTHIS.ŚCLASSREF)
The niladic system method ŚCLASSREF returns a reference to the class of an object, as a scalar. It can also be used with a class reference rather than an object reference, in which case it returns the class reference unchanged.
It can be used with both internal and external classes (but not system classes). However, it is an optional feature for external classes; it is implemented for .Net, Java and Ruby, but is not implemented for R.
DT„'.net' ŚNEW 'System.DateTime' 2007 5 30 DT © DT references an object of the .Net DateTime class [.net:DateTime] CL„DT.ŚCLASSREF CL © CL is a reference to the DateTime class itself {.net:DateTime}
A class reference obtained in this way can be used to create a new object of the same class, by using the class reference as the right argument of ŚNEW (rather than a character vector). In this case, it is not necessary to specify the architecture as the left argument of ŚNEW:
DT2„ŚNEW CL 2007 9 20 12 13 44 © CL can be used to make a new object DT2 © of the same class as DT [.net:DateTime] DT2.ŚDS 20/09/2007 12:13:44