JScript is not an object-oriented language, it is just object-based. It does not have the concept of overloading, but there is still a way to achieve overloading in a sense through some tricks.
First define a base class TestA, which overrides the toString method inherited from Object.
Note: The toString method is used to serialize objects. For example, alert(a) is equivalent to alert(a.toString());
Reference:
function TestA (Name)
{
this.Name = Name;
this.toString = function ()
{
return this.Name;
}
}
Next we implement a derived class TestB of the TestA class:
Reference:
function TestB()
{
TestA.apply(this, arguments);
}
Run the following code to see that TestB has inherited the members of TestA: