Created
June 21, 2011 13:46
-
-
Save martinsik/1037877 to your computer and use it in GitHub Desktop.
Inheritance test
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
function MyClassA() { | |
console.log('constructor for MyClassA'); | |
this.var1 = "hello"; | |
this.var2 = 2; | |
this.method1 = function() { | |
console.log('calling method1 of MyClassA'); | |
} | |
} | |
function MyClassB() { | |
console.log('constructor for MyClassB'); | |
this.var3 = "3 variable"; | |
this.method2 = function() { | |
console.log('calling method2 of MyClassB'); | |
} | |
} | |
MyClassB.prototype = new MyClassA(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment