function showArg3() {
alert(this.arguments[3]);
}
function createObj(arg1, arg2) {
var obj = new Object();
obj.arg1 = arg1;
obj.arg2 = arg2;
obj.showArg3 = showArg3;
return obj;
}
----------------------------------------------------------------------------
function StringBuffer() {
this._strings_ = new Array();
if (typeof StringBuffer._initialized == "undefined") {
StringBuffer.prototype.append = function(str) {
this._strings_.push(str);
};
StringBuffer.prototype.toString = function() {
return this._strings_.join("");
};
StringBuffer._initialized = true;
}
}
------------------------------------------------------------------------------
function ClassA(arg1) {
this.agr1 = arg1;
this.showAgr1 = function() {
alert(this.arg1);
};
}
function ClassB(arg1, arg2) {
//this.newMethod = ClassA;
//this.newMethod(arg1);
//delete this.newMethod;
//ClassA.call(this, arg1);
ClassA.apply(this, new Array(arg1));
this.agr2 = arg2;
this.showAgr2 = function() {
alert(this.arg2);
};
}
------------------------------------------------------------------------------
function ClassAA(arg1) {
this.agr1 = arg1;
}
ClassAA.prototype.showAgr1 = function() {
alert(this.arg1);
};
function ClassBB(arg1, arg2) {
ClassAA.call(this, arg1);
this.agr2 = arg2;
}
//ClassBB.prototype = new ClassAA
ClassBB.prototype.showAgr2 = function() {
alert(this.arg2);
};