Created
March 10, 2012 13:53
-
-
Save kazuho/2011480 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
function Base(x) { | |
// override properties in prototype if necessary | |
if (arguments.length == 1) { | |
this._x = x; | |
} | |
} | |
Base.prototype = { | |
_x: 1 | |
}; | |
function Derived(x) { | |
// override properties in prototype if necessary | |
if (arguments.length == 1) { | |
Base.call(this, x); | |
} | |
} | |
Derived.prototype = new Base(3); // default value of _x is 3 for Derived |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment