JavaScript

Calling Overridden Methods

Rectangle.prototype.toString = function () {
    return "[" + this.width + "," + this.height + "]";
}

PositionedRectangle.prototype.toString = function (){
    return "(" + this.x + "," + this.y +") " +
        Rectangle.prototype.toString.apply(this); //call superclass toString
}


José M. Vidal .

58 of 65