74 lines
1.1 KiB
Plaintext
74 lines
1.1 KiB
Plaintext
type mypoint(mypoint) embed export
|
|
embed
|
|
integer x
|
|
integer y
|
|
|
|
reference
|
|
function copy
|
|
function print
|
|
end type
|
|
|
|
|
|
function mypoint.new(mypoint me, integer x=0, integer y=0)
|
|
me.x = x
|
|
me.y = y
|
|
end function me
|
|
|
|
|
|
function mypoint.copy(mypoint me)
|
|
mypoint p
|
|
|
|
p =@ mypoint.new(me.x, me.y)
|
|
end function p
|
|
|
|
|
|
function mypoint.print(mypoint me)
|
|
end function "mypoint"
|
|
|
|
|
|
type circle(mypoint) embed export
|
|
reference
|
|
mypoint midpoint resolve
|
|
|
|
embed
|
|
integer radius
|
|
|
|
reference
|
|
function copy
|
|
function print
|
|
end type
|
|
|
|
|
|
function circle.new(circle me, integer x=0, integer y=0, integer radius=0, mypoint midpoint)
|
|
if midpoint =@= .nul
|
|
me.midpoint =@ mypoint.new(x, y)
|
|
else
|
|
me.x = midpoint.x
|
|
me.y = midpoint.y
|
|
end if
|
|
|
|
me.radius = radius
|
|
end function me
|
|
|
|
|
|
function circle.copy(circle me)
|
|
circle c
|
|
|
|
c =@ circle.new(radius=me.radius, midpoint=me.midpoint)
|
|
end function c
|
|
|
|
|
|
function circle.print(circle me)
|
|
end function "circle"
|
|
|
|
|
|
function main()
|
|
type(mypoint) p, c
|
|
string result
|
|
|
|
p =@ mypoint.new()
|
|
c =@ circle.new()
|
|
|
|
result = p.print() + "{d}{a}" + c.print() + "{d}{a}"
|
|
end function result
|