Skip to content

Instantly share code, notes, and snippets.

@begin29
Created November 30, 2015 15:11
Show Gist options
  • Save begin29/1c602a7bc07043e0e266 to your computer and use it in GitHub Desktop.
Save begin29/1c602a7bc07043e0e266 to your computer and use it in GitHub Desktop.
extend class in JS
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