RosettaCodeData/Task/Collections/Visual-FoxPro/collections.visual

23 lines
430 B
Plaintext

LOCAL loColl As Collection, o, a1, a2, a3
a1 = CREATEOBJECT("animal", "dog", 4)
a2 = CREATEOBJECT("animal", "chicken", 2)
a3 = CREATEOBJECT("animal", "snake", 0)
loColl = NEWOBJECT("Collection")
loColl.Add(a1)
loColl.Add(a2)
loColl.Add(a3)
FOR EACH o IN loColl FOXOBJECT
? o.Name, o.Legs
ENDFOR
DEFINE CLASS animal As Custom
Legs = 0
PROCEDURE Init(tcName, tnLegs)
THIS.Name = tcName
THIS.Legs = tnLegs
ENDPROC
ENDDEFINE