You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
850B

  1. class Thief
  2. public method steal(v as Vault)
  3. v.secret = 1
  4. v.shown = 2
  5. v.lock()
  6. v.open()
  7. v.make().hidden = 3
  8. v.missing = 4
  9. v.shown(1)
  10. end method
  11. end class
  12. interface Peek
  13. method look() as Vault
  14. end interface
  15. class Vault implements Peek
  16. private word secret
  17. public word shown
  18. word hidden
  19. private method lock()
  20. end method
  21. method open()
  22. self.lock()
  23. self.secret = 1
  24. hidden = 2
  25. end method
  26. public method peer(other as Vault)
  27. other.secret = 2
  28. end method
  29. public method make() as Vault
  30. return self
  31. end method
  32. public method look() as Vault
  33. return self
  34. end method
  35. end class
  36. program Main
  37. var v as Vault
  38. var list as Vault[2]
  39. var p as Peek
  40. v = new Vault()
  41. v.hidden = 1
  42. list[0].secret = 5
  43. print v.shown
  44. p = v
  45. p.look().secret = 6
  46. p.touch()
  47. v.open()
  48. end program

Powered by TurnKey Linux.