Hello,
How can I get the name of a lotusscript class that I have defined?
E.g. I want to print the class name in New method:
Public Class MyObject
public sub new()
print ??? → I want to get printed: “MyObject”
end sub
end class
Thanks in advance
Hello,
How can I get the name of a lotusscript class that I have defined?
E.g. I want to print the class name in New method:
Public Class MyObject
public sub new()
print ??? → I want to get printed: “MyObject”
end sub
end class
Thanks in advance
Subject: LotusScript User-defined Class Name - Print the object’s Class - Typename(object)
Use Typename(yourObject) to access the Class of your user defined objects.
e.g
Class MyObject
Sub new()
Print |"| & Typename(Me) & |".| ' Prints: "MyObject"
End sub
End Class
(Sub New is always Public - The “Public” prefix is superfluous)
If you will be wanting to debug a lot of your classes, then make all your classes inherit from a base class of your own design, so that you can turn logging on and off from a single location, e.g:
[ Script Library “slClassDebugBase” ]
[Declarations]
Class DebugBase
Sub New
' Output object type to user status bar or to Server log when object is constructed.
Print |Constructing object of class "| & Typename(Me) & |".|
End Sub
End Class
[ Script Library “slClassMyObject” ]
[Options]
Use “slClassDebugBase”
[Declarations]
Class MyObject As DebugBase
Sub new()
' The base class's Sub New is called here - Prints class name
'// Your code goes here
End sub
End Class
Subject: RE: LotusScript User-defined Class Name - Print the object’s Class - Typename(object)
Runs perfect! Thank you very much!