RosettaCodeData/Task/Polymorphism/Arturo/polymorphism.arturo
2026-02-01 16:33:20 -08:00

30 lines
510 B
Text

define :point [
init: method [x :floating, y :floating][
this\x: x
this\y: y
]
string: method [][
render "point (x: |this\x|, y: |this\y|)"
]
]
define :circle [
init: method [center :point, radius :floating][
this\center: center
this\radius: radius
]
string: method [][
render "circle (center: |this\center|, radius: |this\radius|)"
]
]
p: to :point [10.0, 20.0]
c: to :circle @[p, 10.0]
inspect p
inspect c
print p
print c