Skip to content

Instantly share code, notes, and snippets.

@iegorov
Created October 29, 2013 04:20
Show Gist options
  • Save iegorov/7209133 to your computer and use it in GitHub Desktop.
Save iegorov/7209133 to your computer and use it in GitHub Desktop.
classical inheritance 1
function Parent(name) {
this.name = name || 'Adam';
}
Parent.prototype.say = function() {
return this.name;
};
function Child() {}
function inherit(C, P) {
C.prototype = new P();
}
inherit( Child, Parent );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment