// Simple functional Inheritance
function gizmo(id) {
return {
id: id, toString: function () {
return "gizmo " + this.id;
}
};
}
function hoozit(id) {
var that = gizmo(id);
that.test = function (testid) {
return testid === this.id;
};
return that;
}
// If we add privacy to the past code we earn
function gizmo(id) {
return {
toString: function () {
return "gizmo " + id;
}
};
}
function hoozit(id) {
var that = gizmo(id);
that.test = function (testid) {
return testid === id;
};
return that;
}
Functional Inheritance
Ярлыки:
Crockford,
JavaScript
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment