Created
April 13, 2010 00:32
-
-
Save coolaj86/364173 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Crockford's Functional Inheritance Example | |
// Slide 68, Act III: Function the Ultimate | |
// http://yuiblog.com/crockford | |
// Parent | |
function gizmo(id) { | |
return { | |
id: id, | |
toString: function () { | |
return "gizmo " + this.id; | |
} | |
}; | |
} | |
// Child | |
function hoozit(id) { | |
var that= gizmo(id); | |
that.test = function (testid) { | |
return testid === this.id; | |
}; | |
return that; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment