class Shape {
static getArea() {
throw new Error('getArea() must be implemented');
}
}
class Circle extends Shape {
constructor(radius) {
super();
this.radius = radius;
}
getArea() {
return Math.PI * this.radius * this.radius;
}
}
The issue is that the static getArea method won't enforce implementation: 1) Static methods are inherited by child classes, but they remain static, 2) The Circle class implements getArea as an instance method, not a static method, 3) These are completely different methods that don't override each other, 4) Static methods cannot be used as abstract methods to enforce implementation, 5) No error will be thrown if a subclass doesn't implement getArea, 6) To enforce interface implementation, instance methods should be used instead.