class BaseClass {
constructor() {}
}
class Point extends BaseClass {
constructor(x, y) {
super();
this.x = x;
this.y = y;
}
add(point) {
return new Point(this.x + point.x, this.y + point.y);
}
sub(point) {
return new Point(this.x - point.x, this.y - point.y);
}
}
var Point1 = Point;
function BaseConstructor() {
}
function Point2(x, y) {
this.x = x;
this.y = y;
}
Point2.prototype.add = function(point) {
return new Point2(this.x + point.x, this.y + point.y);
}
Point2.prototype.sub = function(point) {
return new Point2(this.x - point.x, this.y - point.y);
}
Object.setPrototypeOf(Object.setPrototypeOf(Point2, BaseConstructor).prototype, BaseConstructor.prototype);
function Point3(x, y) {
return Object.setPrototypeOf({
x,
y,
add: (point) => Point3(this.x + point.x, this.y + point.y),
sub: (point) => Point3(this.x - point.x, this.y - point.y)
}, BaseConstructor.prototype);
}