title: classical inheritance vs prototypal inheritance in javascript
body: <p>I have googled so many links and can't get good idea about the difference between classical inheritance and prototypal inheritance?</p>
  
  <p>I have learned some things from these but I'm still confused about the concepts.</p>
  
  <ul>
  <li><p><a href="https://stackoverflow.com/questions/2800964/benefits-of-prototypal-inheritance-over-classical">Benefits of prototypal inheritance over classical?</a></p></li>
  <li><p><a href="http://aaditmshah.github.io/why-prototypal-inheritance-matters/" rel="noreferrer">http://aaditmshah.github.io/why-prototypal-inheritance-matters/</a></p></li>
  </ul>
  
  <p><strong>Classical inheritance</strong> </p>
  
  <pre><code>// Shape - superclass
  function Shape() {
    this.x = 0;
    this.y = 0;
  }
  
  //superclass method
  Shape.prototype.move = function(x, y) {
      this.x += x;
      this.y += y;
      console.info("Shape moved.");
  };
  
  // Rectangle - subclass
  function Rectangle() {
    Shape.call(this); //call super constructor.
  }
  
  //subclass extends superclass
  Rectangle.prototype = Object.create(Shape.prototype);
  </code></pre>
  
  <p>Does classical inheritance use prototypal inheritance inside?</p>
  
  <p><a href="http://aaditmshah.github.io/why-prototypal-inheritance-matters/" rel="noreferrer">http://aaditmshah.github.io/why-prototypal-inheritance-matters/</a></p>
  
  <p>From above link, I learned <strong>we can't add new methods at run time in classical inheritance</strong>. Is this correct? But you can check the above code <strong>I can add "move" method and any methods at run time through prototype</strong>. So this is prototype based classical inheritance? If so what is actual classical inheritance and prototype inheritance? I am confused about that.</p>
  
  <p><strong>Prototypal inheritance.</strong></p>
  
  <pre><code>function Circle(radius) {
      this.radius = radius;
  }
  Circle.prototype.area = function () {
      var radius = this.radius;
      return Math.PI * radius * radius;
  };
  Circle.prototype.circumference: function () {
      return 2 * Math.PI * this.radius;
  };
  var circle = new Circle(5);
  var circle2 = new Circle(10);
  </code></pre>
  
  <p>Is this similar to classical inheritance? I'm totally confused about what is prototypal inheritance? What is classical inheritance? Why is classical inheritance bad? </p>
  
  <p>Can you give me a simple example for better understanding these in a simple manner.</p>
  
  <p>Thanks,</p>
  
  <p>Siva</p>