title: Sub class unable to change super class property in typescript
body: <p>I know this is probably a silly error or I am expecting something that's wrong, nevertheless I am stumped as to what I am missing here. I am new to typescript and I am trying to optimize my Angular app by doing some inheritance jazz.</p>
  <p>So here is what I want to achieve. I have a base component that needs to provide data to one of its drop down boxes but the data is to be provided by a child component (only the child knows what the list values should be based on some login and other criteria). So here is what I did and what I thought would work</p>
  <pre><code>export class BaseComponent implements OnInit
  {
    public list!: string[]; // this is needed for a drop down in my html
  
    constructor(protected service: SomeService) { //injecting service for other tasks in super}
  
    ngOnInit(): void {
      //console.log(this.list) is always empty
    }
  
    public setList(list: string[]) {
      this.list = list;
    }
  }
  
  export class SubComponent extends BaseComponent implements OnInit
  {
    constructor(
      service: SomeService,
    ) {
      super(service);
      super.setList(this.service.getDropDownList1());//only sub class which method to call, like xxxList1 or xxxList 2 etc
  
    }
  }
  </code></pre>
  <p>But on my ngOnInit in the super, list is always empty. I just do not understand why? Given that I am explicitly calling super to set a property on super why does this not work? I have been struggling with what I though was a rudimentary issue but I do not see any way around. Can you please help?</p>
  <p>Thanks,
  Ananth</p>
  <p>PS : In the super class constr, if I explicitly call</p>
  <pre><code>this.service.getDropDownList1()
  </code></pre>
  <p>the list is populated and shows fine in the html. But via the sub class no luck :(</p>
  <p>Also putting console.logs in both constructors and onInits, I noticed that base constructor is getting called twice, dont know why that is happening - probably due to my explicit super call????</p>
  <p>EDIT 1:
  Given that I am from a pure Java background, let me see if I can explain my problem with an example from there!</p>
  <pre><code> class Super {
    String superStr = &quot;&quot;;
  
    public Super()
    {
      System.out.println(&quot; in super constr&quot; + this.superStr);
  
    }
  
    public void setString(String s)
    {
    this.superStr = s;
    }
  
    protected void printStr(){
      System.out.println(&quot;in printStr of super&quot; + this.superStr);
    }
  }
  
  public class Sub extends Super{
    
    public Sub(){
    super.setString(&quot;I am sub setting super str&quot;);
    }
  
  public static void main(String[] args){
    Sub s = new Sub();
    s.printStr();
  }
  
  }
  </code></pre>
  <p>In this case, s.printStr prints the value set in the call to super's setString method. That is what I was expecting to happen in my TS code too. In constr the sub sets the super's list, and on onOnit being called the list will be used to display drop down values. Am I comparing wrongly? Just wanted to make sure I understand this. So would appreciate if you can help me understand what I am getting wrong.</p>
  <p>EDIT 2:
  I am accepting Chris' answer below - his guidance was the most helpful towards me getting a grip on how things work!</p>