title: Renaming a parent class property in subclass
body: <p>In es2015, if I have base class to represent a <code>List</code> that looks like this:</p>
  
  <pre><code>class List {
    constructor(data){
      this.data = data
    }
  
    sortBy(attribute){
      return this.data.sort((a,b) =&gt; {
        return (a[attribute] &lt; b[attribute]) ? 1 : -1;
      })
    }
    get count() { return this.data.length }
  }
  </code></pre>
  
  <p>Then I might want to subclass that base class with a less generic kind of data, namely, if I am an elf, toys:</p>
  
  <pre><code>class ToyList extends List {
    constructor(toys){
      super(toys);
      this.toys = toys;
    }
  }
  </code></pre>
  
  <p>At this point <code>ToyList</code> is no different from <code>List</code>, except for the name. But if you look at an instantiation of <code>ToyList</code>, it has <em>both</em> <code>data</code> and <code>toys</code> properties. These refer to the same array, in terms of conceptualizing the point of a <code>ToyList</code>, <code>data</code> doesn’t make much sense.</p>
  
  <p>If I make a <code>ToyList</code>, I have both <code>.data</code> and a <code>.toys</code> attributes:</p>
  
  <pre><code>tl = new ToyList(['truck', 'plane', 'doll'])
  Object { data: Array[3], toys: Array[3] }
  </code></pre>
  
  <p>Then my <code>tl</code> has both a <code>data</code> and a <code>toys</code> attribute. They’re both references to the same array, but what I would like is for the subclass to <em>only</em> have the <code>toys</code> reference. </p>
  
  <p>Here’s another example which utilizes a method on the base class:</p>
  
  <pre><code>class Todos extends List {
    constructor(todos){
      super(todos);
      this.todos = todos;
    }
  
    get byPriority(){
      return this.todos.sortBy('priority')
    }
  }
  
  var thingsToDo = [
    {task: 'wash the dog', priority: 10},
    {task: 'do taxes', priority: 1},
    {task: 'clean the garage', priority: 0}
  
  ]
  
  var todos = new Todos(thingsToDo);
  todos.byPriority
  </code></pre>
  
  <p>This would be nice, because then I could just refer to <code>.byPriority</code> to get a sorted version of the list which is very specific to this particular kind of data. But I can’t see how I can make that happen, because  </p>
  
  <p>But what I get is:</p>
  
  <pre><code>TypeError: this.todos.sortBy is not a function
  </code></pre>
  
  <p>So to summarize, what I want is a way to refer to to base class properties with a name which is specific to the semantics of the subclass, without losing the methodology of the base class.</p>