extendednewtest.bmx 618 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. ' This just shows that when you create an object of type 'Tester',
  2. ' it inherits the New method of 'Test'...
  3. ' Base type...
  4. Type Test
  5. Global Oink
  6. Field x
  7. Field y
  8. Method New ()
  9. x = 100
  10. y = 200
  11. Oink = Oink + 1
  12. End Method
  13. End Type
  14. ' Another type extending the base type above...
  15. Type Tester Extends Test
  16. Field z = 99
  17. End Type
  18. ' Create a 'Tester' object...
  19. t:Tester = New Tester
  20. ' As well as the 'z' field of 't', x and y have values, demonstrating
  21. ' that they must have been set by the Test.New () method...
  22. Print t.x
  23. Print t.y
  24. Print t.z