class AbstractClass {
constructor() {
}
set property(value) {
this.property_ = value;
}
get property() {
return this.property_;
}
}
class Subclass extends AbstractClass {
constructor() {
super();
}
set property(value) {
super.property = value;
if (!(this.property_ instanceof SubclassAssociatedClass)) throw new TypeError();
}
//get property() {
// return super.property;
//}
}
set
属性のメソッドをオーバーライドすると、メソッドもオーバーライドget
する必要があるように見えます。undefined
get
get property()
これは仕様の一部であると思いますが、動作がクロス コンパイルの結果である可能性があります。確かに、これはオーバーライドされたセッターとゲッターをコーディングする正しい方法ですか (同時にまたはまったくない)?