在派生类中访问super
a 的值getter
似乎不起作用:
class Foo {
private _message:string = "Hello,";
public get Message():string {
return this._message;
}
}
class Bar extends Foo {
public get Message():string {
return super.Message + " World";
}
}
var snafu:Bar = new Bar();
document.write(snafu.Message);
// Expected: "Hello, World"
// Actual: "undefined World"
如何正确覆盖 agetter
并使用该super
值?