Created
February 26, 2016 21:56
-
-
Save bpander/ca8cfd3bd1eb8652dccd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Base class | |
function Shape (x, y) { | |
this.x = x; | |
this.y = y; | |
} | |
// Rectangle extends Shape | |
function Rectangle (x, y, width, height) { | |
Shape.call(this, x, y); | |
this.width = width; | |
this.height = height; | |
} | |
Rectangle.prototype = Object.create(Shape.prototype); | |
Rectangle.prototype.constructor = Rectangle; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment