inheritance - How do you access properties of base class in Typescript?

ID : 274541

viewed : 32

Tags : inheritancepropertiestypescriptsuperclassinheritance





Top 2 Answer for inheritance - How do you access properties of base class in Typescript?

vote vote

90

use this rather than super :

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 this.x;     } }  var b:B = new B(); alert(b.method()); 
vote vote

84

Top 3 video Explaining inheritance - How do you access properties of base class in Typescript?







Related QUESTION?