Created
October 22, 2012 17:55
-
-
Save corpix/3932970 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
| 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