2016-04-13 11:08:28 +03:00
|
|
|
type
|
|
|
|
|
Point = auto class
|
|
|
|
|
x,y: integer;
|
2020-11-16 20:04:43 +03:00
|
|
|
procedure MoveBy(dx,dy: integer) := (x,y) := (x+dx,y+dy);
|
2016-04-13 11:08:28 +03:00
|
|
|
function Distance(p: Point) := sqrt(sqr(x-p.x)+sqr(y-p.y));
|
|
|
|
|
class function operator implicit(t: (integer,integer)): Point := new Point(t[0],t[1]);
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
var p: Point;
|
|
|
|
|
p := (2,3);
|
|
|
|
|
Println(p);
|
|
|
|
|
end.
|