選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

64 行
959B

  1. interface Shape
  2. method area() as word
  3. end interface
  4. class Box implements Shape
  5. private word side
  6. public method init(s as word, t as byte)
  7. side = s + t
  8. end method
  9. public method area() as word
  10. return side
  11. end method
  12. public method scale(f as byte) as word
  13. if f = 0
  14. return 0
  15. end if
  16. end method
  17. public method pick(f as boolean) as word
  18. while f
  19. return 1
  20. end while
  21. end method
  22. public method both(f as boolean) as word
  23. if f
  24. return 1
  25. else
  26. return
  27. end if
  28. end method
  29. public method none()
  30. return 5
  31. end method
  32. public method wrong() as boolean
  33. return side
  34. end method
  35. end class
  36. class Bare
  37. end class
  38. program Main
  39. var b as Box
  40. var s as Shape
  41. var w as word
  42. b = new Box(1)
  43. b = new Box(1, 2, 3, 4)
  44. b = new Box(1, true)
  45. b = new Box(-1, 2)
  46. w = b.scale()
  47. w = b.scale(1, 2)
  48. w = s.area(5)
  49. s = new Shape()
  50. s = new Bare(1)
  51. return 1
  52. return
  53. end program

Powered by TurnKey Linux.