53 lines
993 B
Plaintext
Executable File
53 lines
993 B
Plaintext
Executable File
plex Point {
|
|
nat x;
|
|
nat y;
|
|
|
|
init(nat x, nat y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
|
|
toS() {
|
|
pln("[x:%d, y:%d]",
|
|
this.x,
|
|
this.y);
|
|
}
|
|
}
|
|
|
|
plex Rect {
|
|
Point top_left;
|
|
Point bottom_right;
|
|
nat width;
|
|
nat height;
|
|
|
|
init(Point tl, Point br, nat width, nat height) {
|
|
this.top_left = tl;
|
|
this.bottom_right = br;
|
|
this.width = width;
|
|
this.height = height;
|
|
}
|
|
|
|
toS() {
|
|
pln("[top_left: [x:%d, y:%d], bottom_right: [x:%d, y:%d], width:%d, height:%d]]",
|
|
this.top_left.x,
|
|
this.top_left.y,
|
|
this.bottom_right.x,
|
|
this.bottom_right.y,
|
|
this.width,
|
|
this.height);
|
|
}
|
|
}
|
|
|
|
function create_geometry() Rect {
|
|
Point tl(10, 20);
|
|
Point br(100, 50);
|
|
Rect final_rect(tl, br, 90, 180);
|
|
return final_rect;
|
|
}
|
|
|
|
function main() int {
|
|
Rect r = create_geometry();
|
|
print(r.toS());
|
|
return 0;
|
|
}
|