| 1 |
class Point { |
| 2 |
#x = 1; |
| 3 |
#y = 2; |
| 4 |
|
| 5 |
constructor(x = 0, y = 0) { |
| 6 |
this.#x = +x; |
| 7 |
this.#y = +y; |
| 8 |
|
| 9 |
this.foo = class { |
| 10 |
#x = 1; |
| 11 |
#y = 2; |
| 12 |
|
| 13 |
constructor(x = 0, y = 0) { |
| 14 |
this.#x = +x; |
| 15 |
this.#y = +y; |
| 16 |
} |
| 17 |
|
| 18 |
get x() { return this.#x } |
| 19 |
set x(value) { this.#x = +value } |
| 20 |
|
| 21 |
get y() { return this.#y } |
| 22 |
set y(value) { this.#y = +value } |
| 23 |
|
| 24 |
equals(p) { return this.#x === p.#x && this.#y === p.#y } |
| 25 |
|
| 26 |
toString() { return `Point<${ this.#x },${ this.#y }>` } |
| 27 |
}; |
| 28 |
} |
| 29 |
|
| 30 |
get x() { return this.#x } |
| 31 |
set x(value) { this.#x = +value } |
| 32 |
|
| 33 |
get y() { return this.#y } |
| 34 |
set y(value) { this.#y = +value } |
| 35 |
|
| 36 |
equals(p) { return this.#x === p.#x && this.#y === p.#y } |
| 37 |
|
| 38 |
toString() { return `Point<${ this.#x },${ this.#y }>` } |
| 39 |
} |