LOTUSSCRIPT LANGUAGE
This example creates both an array and a list of objects of class Fruit:
' Declare an array of references to base class: a Fruit Basket.
Dim Basket( 1 to 4 ) As Fruit
Set Basket(1) = New Apple(0.86, "Green", "Macintosh", 24)
Set Basket(2) = New Apple(0.98, "Red", "Delicious",33)
Set Basket(3) = New Banana(0.32, "Yellow")
Set Basket(4) = New Apple(1.2, "Yellow", "Delicious",35)
' Declare a list of references to base class: a Fruit Bucket.
Dim Bucket List As Fruit
Set Bucket("1") = New Apple(0.86, "Green", "Macintosh", 24)
Set Bucket("2") = New Apple(0.98, "Red", "Delicious",33)
Set Bucket("3") = New Banana(0.32, "Yellow")
Set Bucket("4") = New Apple(1.2, "Yellow", "Delicious",35)
' Prepare all of the fruit in the Basket.
ForAll YummyThing in Basket
YummyThing.Prepare ' Call each object's Prepare sub.
End ForAll
' Prepare all of the fruit in the Bucket.
ForAll FruityThing in Bucket
FruityThing.Prepare ' Call each object's Prepare sub.
See Also