|
- interface Shape
- method area() as word
- end interface
-
- class Box implements Shape
- private word side
-
- public method init(s as word, t as byte)
- side = s + t
- end method
-
- public method area() as word
- return side
- end method
-
- public method scale(f as byte) as word
- if f = 0
- return 0
- end if
- end method
-
- public method pick(f as boolean) as word
- while f
- return 1
- end while
- end method
-
- public method both(f as boolean) as word
- if f
- return 1
- else
- return
- end if
- end method
-
- public method none()
- return 5
- end method
-
- public method wrong() as boolean
- return side
- end method
- end class
-
- class Bare
- end class
-
- program Main
- var b as Box
- var s as Shape
- var w as word
- b = new Box(1)
- b = new Box(1, 2, 3, 4)
- b = new Box(1, true)
- b = new Box(-1, 2)
- w = b.scale()
- w = b.scale(1, 2)
- w = s.area(5)
- s = new Shape()
- s = new Bare(1)
- return 1
- return
- end program
|