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;
        }
原文地址:https://www.cnblogs.com/wangwenfei/p/javascript_klass.html