有人能为我解释一下以下内容吗?
class BaseClass {
prop = 88;
constructor(){
console.log("baseClass prop is ", this.prop);
}
}
class DerivedClass extends BaseClass{
prop = 83;
constructor(){
super();
console.log("derivedClass prop is ", this.prop);
}
}
new derivedClass();
输出结果为
baseClass prop is 88
derivedClass prop is 83
现在这两个属性不应该是一样的吗(83)?因为一个属性覆盖了另一个属性? 我是否理解错了?