
/**
 * Provides functionality for inherited classes to call their super class' constructor.
 * @field	id Integer		A unique ID for each instance that can be used with Util.getInstance.
 * @field	refString String		A string that evals to the class instance.
 */
function BaseObject () {
	this.id = Util.registerInstance( this );
	this.refString = "Util.getInstance(" + this.id + ")";
}

/**
 * Calls the constructor of the parent class. Arguments are passed along.
 */
BaseObject.prototype.superConstructor = function () {
	// Retrieve the superConstructor class property from the constructor that is invoking this method and invoke with this instance's context.
	this.superConstructor.caller.superConstructor.apply( this, arguments );
}

/**
 * A convenience function for getting a delegate for a method on this instance.
 * @param	methodName String
 */
BaseObject.prototype.getDelegate = function ( methodName ) {
	// Pass along all the arguments to the actual getDelegate function.
	var args = Util.argumentsToArray( arguments );
	args.unshift( this );  // Prepend the instance parameter.
	return Util.getDelegate.apply( null, args );
}
