11
C'era un suggerimento di utilizzare il codice come questoCome si accede alle proprietà della classe base in Typescript?
class A {
// Setting this to private will cause class B to have a compile error
public x: string = 'a';
}
class B extends A {
constructor(){super();}
method():string {
return super.x;
}
}
var b:B = new B();
alert(b.method());
ed è anche ottenuto 9 voti. Ma quando lo incolli nel parco giochi ufficiale di TS http://www.typescriptlang.org/Playground/ ti dà ed errore.
Come accedere alla proprietà x di A da B?
Champion! Spiacenti, non ho abbastanza reputazione per +1 –
@AlexVaghin puoi/dovrebbe contrassegnare come risposta – basarat