zoukankan      html  css  js  c++  java
  • javascript Klass 实现

    var Klass=function(Parent,props){
                var Child,F,i;
                Child=function(){
                    if(Child.uber && Child.uber.hasOwnProperty("__construct")){
                        Child.uber.__construct.apply(this,arguments);
                    }
                    if(Child.prototype.hasOwnProperty("__construct")){
                        Child.prototype.__construct.apply(this,arguments);
                    }
                }
                Parent=Parent || Object;
                F=function(){};
                F.prototype=Parent.prototype;
                Child.prototype=new F();
                Child.uber=Parent.prototype;
                Child.prototype.construct=Child;
    
                for(var i in props){
                    if(props.hasOwnProperty(i)){
                        Child.prototype[i]=props[i];
                    }
                }
                return Child;
            }
  • 相关阅读:
    Java工具类
    集合 -- 嵌套表
    集合--索引表
    第一章
    记录Record
    序列Sequence
    操纵数据库 DML
    表的集合操作
    视图
    索引
  • 原文地址:https://www.cnblogs.com/wangwenfei/p/javascript_klass.html
Copyright © 2011-2022 走看看