I'm new to javascript.
I'm writing an object oriented program to find area of a rectangle and a square. I have three classes - Shape, Square and Rectangle. I would like to inherit parent class - Shape, into the child class - Square, I ran into a problem related to prototypes. Code:
Square.prototype= new Shape();
Square.prototype.__proto__= Shape.prototype;
I would like to know:
1. Whether writing Square.prototype= new Shape();
would suffice in terms of inheriting the class Shape into class Square?
2. What difference does the line:
Square.prototype.__proto__= Shape.prototype;
cause to class Square.
Any help is much appreciated, thanks!