Created
November 30, 2015 15:11
-
-
Save begin29/1c602a7bc07043e0e266 to your computer and use it in GitHub Desktop.
extend class in JS
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 BaseClass() | |
{ | |
this._map = {}; | |
}; | |
BaseClass.prototype.parseXML = function( key, value ) | |
{ | |
alert("BaseClass::parseXML()"); | |
this._map[key] = value; | |
} | |
function ChildClass() | |
{ | |
BaseClass.call(this); | |
} | |
ChildClass.prototype = Object.create(BaseClass.prototype); | |
ChildClass.prototype.parseXML = function( key, value, otherData ) | |
{ | |
alert("ChildClass()::parseXML()"); | |
//BaseClass.prototype.parseXML.call(this, key, value); | |
} | |
var a = new ChildClass(); | |
a.parseXML(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment