self.bmx 394 B

12345678910111213141516171819202122232425262728
  1. Rem
  2. Self is used in BlitzMax Methods to reference the invoking variable.
  3. End Rem
  4. Type MyClass
  5. Global count
  6. Field id
  7. Method new()
  8. id=count
  9. count:+1
  10. ClassList.AddLast(self) 'adds this new instance to a global list
  11. End Method
  12. End Type
  13. Global ClassList:TList
  14. classlist=new TList
  15. local c:MyClass
  16. c=new MyClass
  17. c=new MyClass
  18. c=new MyClass
  19. for c=eachin ClassList
  20. print c.id
  21. next