Triangle.prototype = new Shape(); Triangle.prototype.getArea = function () { return 0.5 * this.base * this.height; }; function Rectangle(iLength, iWidth) { Shape.call(this, 4); this.length = iLength; this.width = iWidth;
}
Rectangle.prototype = new Shape(); Rectangle.prototype.getArea = function () { return this.length * this.width; }; var triangle = new Triangle(12, 4); var rectangle = new Rectangle(22, 10);