begin29
11/30/2015 - 3:11 PM

extend class in JS

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();