Questions tagged «typescript1.4»

4
从打字稿中的超类调用重写的方法
当我从超类构造函数中调用重写的方法时,我无法正确获取子类属性的值。 例 class A { constructor() { this.MyvirtualMethod(); } protected MyvirtualMethod(): void { } } class B extends A { private testString: string = "Test String"; public MyvirtualMethod(): void { alert(this.testString); // This becomes undefined } } 我想知道如何正确覆盖打字稿中的函数。
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.