Skip to content

Instantly share code, notes, and snippets.

@corpix
Created October 22, 2012 17:55
Show Gist options
  • Select an option

  • Save corpix/3932970 to your computer and use it in GitHub Desktop.

Select an option

Save corpix/3932970 to your computer and use it in GitHub Desktop.
наследование
var Me = function(){
this.name = 'Dmitriy';
}
Me.prototype.printName = function(){
console.log(this.name);
}
var You = function(){
this.name = 'Username';
}
You.prototype.printName = Me.prototype.printName;
var me = new Me();
var you = new You();
me.printName();
you.printName();
You.prototype.printName = function(){
console.log('Leonide');
}
you.printName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment