Created
November 11, 2013 03:56
-
-
Save escusado/7407598 to your computer and use it in GitHub Desktop.
This file contains 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
Class('MyParenClass')({ | |
prototype : { | |
init : function (options){ | |
this.myName = 'minombre' | |
return this; | |
} | |
} | |
}); | |
Class('MyChildrenClass').inherits(MyParenClass)({ | |
prototype : { | |
init : function(){ | |
console.log('this will fail', this.name); | |
this.constructor.init.call(this); | |
console.log('this is ok', this.name); | |
} | |
} | |
}); | |
var myInstance = new MyChildrenClass(); | |
myInstance.name // -> 'mi nombre' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment