Code
function BaseA(id,name)
{
this.id = id;
this.name = name;
this.ShowName = function()
{
document.write(this.name);
}
this.ShowId = function()
{
document.write(this.id);
}
}
var a1 = new BaseA(1,"A");
a1.ShowName();
function BaseB(id,name)
{
this.newMethod = BaseA;
this.newMethod(id);
delete this.newMethod;
this.id = id;
this.name = name;
this.Show = function()
{
document.write(this.id + "--" +this.name);
}
}
var b1 = new BaseB(2,"b");
b1.ShowName();
b1.ShowId();
b1.Show();