Types and 'the penny dropping'

BlitzMax Forums/BlitzMax Beginners Area/Types and 'the penny dropping'

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Once advantage of keeping the list global is the fact that you can throw different types in there.

Look .. cats and dogs living in harmony:
Global list:TList=CreateList()

Type cattype
	Field name$
	Method New()
		ListAddLast list,Self
	End Method
End Type

Type dogtype
	Field name$
	Method New()
		ListAddLast list,Self
	End Method
End Type

Local c:cattype
Local d:dogtype

c=New cattype
c.name="Felix"
c=New cattype
c.name="Garfield"
d=New dogtype
d.name="Rover"
d=New dogtype
d.name="Tyson"

Print "Cats:"
For c=EachIn list
	Print "  > "+c.name
next

Print "Dogs:"
For d=EachIn list
	Print "  > "+d.name
next

Input "Done. Return to end ..."