[code=JScript]rnvar Class = rn create: function() rn var parent = null, properties = $A(arguments);rn if (Object.isFunction(properties[0]))rn parent = properties.shift();rn rn function klass() rn rn this.initialize.apply(this, arguments);rn rn Object.extend(klass, Class.Methods);rn klass.superclass = parent;rn klass.subclasses = [];rn if (parent) rn var subclass = function() ;rn subclass.prototype = parent.prototype;rn klass.prototype = new subclass;rn parent.subclasses.push(klass);rn rn for (var i = 0; i < properties.length; i++)rn klass.addMethods(properties[i]);rn if (!klass.prototype.initialize)rn klass.prototype.initialize = Prototype.emptyFunction;rn klass.prototype.constructor = klass;rnrn return klass;rn rn;rnrnClass.Methods = rn addMethods: function(source) rn var ancestor = this.superclass && this.superclass.prototype;rn //Treats any object as a Hash and fetches the list of its property names.rn var properties = Object.keys(source);rn if (!Object.keys( toString: true ).length)rn properties.push("toString", "valueOf");rn for (var i = 0, length = properties.length; i < length; i++) rn var property = properties[i], value = source[property];rn if (ancestor && Object.isFunction(value) &&rn value.argumentNames().first() == "$super") rn var method = value, value = Object.extend((function(m) rn return function() return ancestor[m].apply(this, arguments) ;rn )(property).wrap(method), rn valueOf: function() return method ,rn toString: function() return method.toString() rn );rn rn this.prototype[property] = value;rn rnrn return this;rn rn;rnrn[/code]rnrn谁能详细解释下,关于类的函数详细原理和流程.谢谢. 论坛