aUCBLogo Demos and Tests / testobj
be testobj
p=Point 3 4
p2=Point 6 7
(show p'x p'y)
(show p2'x p2'y)
show (p'distance p2)
m=Matrix_ p p2
(m'add m)
m'print
show m'det
show (m'x)'x
p'hallo
p'greet
p2'hallo
p2'greet
m'hallo
(m'x)'hallo
end
be Halloer mytype
be hallo
(type [Hallo, I am\ ] mytype "\ string [.])
(print)
end
end
be Greeter mytype
be greet
(type [Greetings from a\ ] mytype [!])
(print)
end
end
be Point x y
inherit Halloer "Point
inherit Greeter "Point
be distance b
output sqrt (sqr x-b'x)+(sqr y-b'y)
end
be incx
x=x+1
end
be add p
x=x+p'x
y=y+p'y
end
be print
::print list x y
end
be string
output list x y
end
end
be Matrix_ x y
inherit Halloer "Matrix_
be det
output x'x*y'y-x'y*y'x
end
be add m
(x'add m'x)
(y'add m'y)
end
be print
x'print
y'print
::print Point::string
end
be string
output list x'string y'string
end
end