欢迎大家提建议
效果:
class Point {
x = 0;
y = 0;
constructor(_x, _y) {
if(_x) this.x = _x;
if(_y) this.y = _y;
}
operatorAdd = (b) => {
const a = this;
return new Point(a.x + b.x, a.y + b.y);
}
operatorMul = (b) => {
const a = this;
return new Point(a.x * b, a.y * b);
}
};
let a = new Point(1, 2), b = new Point(3, 4);
console.log(a + b * 3);
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。