Created
August 22, 2014 19:28
-
-
Save alexdibattista/1ee249f9b2eee7a6666a 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
| MyBaseClass = function(a) { | |
| this.a = a; | |
| }; | |
| MyBaseClass.prototype.filter = function(){ | |
| console.log('I am initializing the base class'); | |
| }; | |
| MyChildClass = function(a){ | |
| this.a = a; | |
| }; | |
| MyChildClass.prototype = Object.create(MyBaseClass.prototype); | |
| MyChildClass.prototype.filter = function(){ | |
| MyBaseClass.prototype.filter.call(this); | |
| console.log('I am initializing the child class'); | |
| }; | |
| MyChildClass2 = function(a){ | |
| this.a = a; | |
| }; | |
| MyChildClass2.prototype = Object.create(MyBaseClass.prototype); | |
| MyChildClass2.prototype.filter = function(){ | |
| MyBaseClass.prototype.filter.call(this); | |
| console.log('I am initializing the child class2'); | |
| }; | |
| var child = new MyChildClass(); | |
| console.log(child); | |
| var child2 = new MyChildClass2(); | |
| console.log(child2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment