• 模拟类式继承


    //模拟类式继承
    //Douglas Crockford
    Function.prototype.method = function(name,func) {
        this.prototype[name] = func;
        return this;
    };
    
    Function.method('inherits', function(parent) {
        var depth = 0;
        var proto = this.prototype = new parent();
        this.method('uber', function uber(name)) {
            var func;
            var ret;
            var v = parent.prototype;
            if(depth) {
                //上溯必要的depth,找到原始的prototype
                for(var i=d;l i>0; i+=1) {
                    v = v.constructor.prototype;
                }
                func = v[name];    
            } else {
                func = proto[name];
                if(func == this[name]) {
                    func = v[name];
                }
            }
            depth +=1 ;
            ret = func.apply(this,Array.prototype.slice.apply[arguments,[1]]);
            depth -= 1;
            return ret;
        });
        return this;
    });
    
    Function.method('swiss', function(parent)) {
        for(var i=1; i<arguments.length; i+=1) {
            var name = arguments[i];
            this.prototype[name] = parent.prototype[name];
        }
        return this;
    });
  • 相关阅读:
    ER图
    uml图
    第一个迭代任务的制作
    软件测试
    实训记录
    UML系列图——ER图
    UML系列图——用例图
    第一个迭代任务进度
    第一个迭代任务
    需求分析——WBS
  • 原文地址:https://www.cnblogs.com/lambdatea/p/3389519.html
Copyright © 2020-2023  润新知