Skip to content

Instantly share code, notes, and snippets.

@martinsik
Created June 21, 2011 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinsik/1037877 to your computer and use it in GitHub Desktop.
Save martinsik/1037877 to your computer and use it in GitHub Desktop.
Inheritance test
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