Skip to content

Instantly share code, notes, and snippets.

@remy
Created December 13, 2009 03:36
Show Gist options
  • Save remy/255243 to your computer and use it in GitHub Desktop.
Save remy/255243 to your computer and use it in GitHub Desktop.
function Foo(name) {
this.type = 'foo';
}
Foo.prototype = {
name: function (name) {
if (name) {
this._name = name;
} else {
return this._name;
}
},
age: function (age) {
if (age) {
this._age = age;
} else {
return this._age;
}
}
};
function Bar() {
this.type = 'bar';
}
Bar.prototype = new Foo;
Bar.prototype.size = function () {
return 'm';
};
var bar = new Bar();
bar.age(32);
alert(bar.age());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment