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); // 调用父类的constructor(x, y)
this.color = color;
}
}
const cp = new ColorPoint(1, 2, 3)
为什么 cp.hello() 会报hello is not a function.