title: ES6 Classes ability to perform polymorphism
body: <p>I am trying to emulate polymorphism through ES6 Classes, in order to be able to better understand this theory. </p>
  
  <p>Concept is clear (<em>designing objects to share behaviors and to be able to override shared behaviors with specific ones</em>) but I am afraid my code above is not a valid polymorphism example. </p>
  
  <p>Due to my lack of experience, I appreciate if you answer these questions in a comprehensive way:</p>
  
  <ul>
  <li>The fact that both Classes have an equally named method, and that instances made from each Class get access correctly to their respective methods, makes this a polymorphic example?</li>
  <li>In case this does not emulate polimorphism, what changes should be
  done in the code for it?</li>
  <li>I've tried removing the <code>Employee.prototype = new Person();</code> line, and it still works. This is why I am afraid I'm not getting this concept.</li>
  </ul>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>class Person {
    constructor (name, age) {
      this._name = name;
      this._age = age;
    }
  }
  
  Person.prototype.showInfo = function(){
    return "Im " + this._name + ", aged " + this._age;
  };
  
  
  class Employee {
    constructor (name, age, sex) {
      this._name = name;
      this._age = age;
      this._sex = sex;
    }
  }
  
  Employee.prototype = new Person();
  
  Employee.prototype.showInfo = function(){
    return "Im " + this._sex + ", named " + this._name + ", aged " + this._age;
  };
  
  
  var myPerson = new Person('Jon', 20);
  var myEmployee = new Employee('Doe', 10, 'men');
  
  document.write(myPerson.showInfo() + "&lt;br&gt;&lt;br&gt;");   // Im Jon, aged 20
  document.write(myEmployee.showInfo() + "&lt;br&gt;&lt;br&gt;"); // Im men, named Doe, aged 10</code></pre>
  </div>
  </div>
  </p>