class Point {
constructor(x, y) {
this.x = x;
this.y = y;
}
static hello() {
console.log('hello')
}
sayHello() {
console.log('say hello')
}
}
class ColorPoint extends Point{
constructor(x, y, color) {
super(x, y); // 調(diào)用父類(lèi)的constructor(x, y)
this.color = color;
}
}
const cp = new ColorPoint(1, 2, 3)
為什么 cp.hello() 會(huì)報(bào)hello is not a function.