• Browse Blogs
  • My Blog
  • My Updates

+Tags Get help with tags?

  • View as cloud  | list

+ Similar Blogs

photo

Yellow is the...

72 Entries |  Tim Tripcony
Updated 
RatingsRatings 2     CommentsComments 34
photo

Lotus Nut

111 Entries |  Chris Whisonant
Updated 
RatingsRatings 23     CommentsComments 157
photo

Patrick Picar...

62 Entries |  Patrick Picard
Updated 
RatingsRatings 2     CommentsComments 112
photo

Urs Meli

42 Entries |  Urs Meli
Updated 
No RatingsRatings 0     CommentsComments 48
photo

TexasSwede

109 Entries |  Karl-Henry Martinsso...
Updated 
No RatingsRatings 0     CommentsComments 94

+ Bookmarks

+ Blog Authors  

All entries tagged with polymorphism

1 - 1 of 1
  • Previous
  • Next
  • Page   1

Polymorphism with LotusScript

Peter Presnell |   | Tags:  oop .dominoframework polymorphism | Comments (5)  |  Visits (899)
Of all the terms in programming I think polymorphism is one of the coolest.  While I cannnot include eclipse plug-in developer on my resume, I think being able to feature a cool term like polymorphism on my resume must be worth an extra $10 for my hourly rate!!!

Polymorphism is a common feature available in most object oriented programming languages such as java, c#, and VB.Net.  Search the Domino designer help and you will not find any mentions of this term.  In the limited coverage given to classes there are no hints as to polymorphism being available.  And yet, it does seem that LotusScript can perform a limited amount of polymorphism.

If you are a LotusScript developer you may not have had the need to ever understand polymorphism (even if it did add $10 to your hourly rate).   Consider a simple HR database such as the following:-
Class Person
' ...
End Class

Class Associate As Person
' ...
End Class

Class Contractor As Person
' ...
End Class

Class Manager As Associate
' ...
End Class
I could read a document from a Notes HR-related  database and then assign it to a variable that is any one of the above classes.  But what if I then wanted to start treating that variable like it belonged to one of the related classes?  In C# this can be achieved using casting.  It turns out that with LotusScript that the following code is possible:-
Dim Employee As Person
Set Employee = New Person(Doc)
Call Employee.Update()
Set Employee = New Manager(Doc)
Call Employee.Update()
In the above... The first time the Update method is invoked it will call the method defined in the Person class.  The second time the update method is called it invokes the method defined in the Manager class (assuming it exists).  There are some limitations with this approach.  In particular, the properties/methods must all be defined in the base class.

The .Domino Framework provides 100+ custom classes defined so the need for polymorphism does arise periodically and will now be implemented using the above technique (for no other reason than to add polymorphism to my resume).

No RatingsRatings 0

  • Previous
  • Next
Jump to page of 1
Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About