class Point {
interface Stringable;
interface Cloneable;
has x : rw int;
has y : rw int;
static method new : Point () {
return new Point;
}
static method new_xy : Point ($x : int, $y : int) {
my $point = Point->new;
$point->set_x($x);
$point->set_y($y);
return $point;
}
method to_string : string () {
my $x = $self->x;
my $y = $self->y;
my $string = "($x,$y)";
return $string;
}
method cloneable_clone : object () {
my $point_clone = Point->new_xy($self->x, $self->y);
return $point_clone;
}
}