February 10, 2007

Inheritance and Polymorphism on LotusScript

Here is a derived class called MyClass2 that uses the base class MyClass1:
Class MyClass1 ' Base class.
a As Integer
Public c As Integer
'...
End Class

Class MyClass2 As MyClass1 ' Class derived from MyClass1.
b As Integer
Public d As Integer
'...
End Class
Dim x As New MyClass ' Object x has members
' a%, b%, c%, and d%.
x.c% = 12
x.d% = 35

Then, Polymorphism, in my eyes, LotusScript does not support polymorphism or overloading.

Trying to explain inheritance and polymorphism
Using the object-oriented features of LotusScript
Head First Object-Oriented Analysis and Design
Object Orientated Lotusscript Presentation
Object Orientated Programming in LotusScript (The View)
LS2007-AD507 - Leveraging the Power of Object Oriented Programming in LotusScript
LS2007-BP301- Advanced Object Oriented Programming for LotusScript

Posted by philipz at 04:22 PM | Comments (2)

February 09, 2007

How to Handle Errors on LotusScript

Function test(param1 As String) As Integer
Test = False
On Error Goto errorhandler
' do something here!
Test = True
exitFunction:
Exit Function
errorhandler:
Call raiseError()
Resume exitfunction
End Function

Function raiseError() As Integer
raiseError = False
' Remember. No error trapping here!
Print "Run time error: (" & Cstr(Err) & ":" & Error$ & " at line: " & Cstr(Erl)
raiseError = True
Exit Function
End Function

Function raiseError() As Integer
raiseError = False
Print "Run time error: (" + Cstr(Err) & ":" & Error$ & " at line: " & Cstr(Erl) & _
" called from: " & Getthreadinfo(11) & " in module: " & Getthreadinfo(10)
raiseError = True
End Function

Posted by philipz at 03:07 PM | Comments (0)