class vector { private: double x, y public: class literal { double v class: module Literal(.v) { } } operator "+" (b as vector){ .x+=b.x .y+=b.y } operator "-" (b as vector){ .x-=b.x .y-=b.y } operator "*" (b as literal){ .x*=b.v .y*=b.v } operator "/" (b as literal){ .x/=b.v .y/=b.v } property printVector { value { link parent x, y to x, y value=format$(.fm$, str$(round(x,.r), .Lcid),if$(y>=0->"+", "-"),str$(abs(round(y,.r)),.lcid)) } }="" // make type string // added members to printVector (is a group type) group printVector { integer Lcid=1033 fm$="{0} î {1}{2} û" r=6 } class: module vector(r as double, theta as double, Lcid=1033) { def deg(rad)=rad*180@/pi .printVector.Lcid<=Lcid .x<=r*cos(deg(theta)) .y<=r*sin(deg(theta)) } } document s$ a=vector(3,pi/6) s$="Vector a : "+a.printVector+{ } b=vector(5,2*pi/3) s$="Vector b : "+b.printVector+{ } sum_a_b=a+b s$="Sum of vectors a and b : "+sum_a_b.printVector+{ } diff_a_b=a-b s$="Difference of vectors a and b : "+diff_a_b.printVector+{ } mul_a_3=a*a.literal(3) s$="Multiplying vector a by 3 : "+mul_a_3.printVector+{ } div_b_2.5=b/b.literal(2.5) s$="Dividing vector b by 2.5 : "+div_b_2.5.printVector+{ } report s$ clipboard s$