javascript 继承实现

function extend(subClass, superClass){
            var C=function(){};
            C.prototype=superClass.prototype;
            subClass.prototype=new C();
            subClass.prototype.constructor=subClass;
            subClass.superClass=superClass.prototype;
            if(superClass.prototype.constructor == Object.prototype.constructor){
                superClass.prototype.constructor=superClass;
            }
        }

  

posted on 2013-12-03 11:38  dubaokun  阅读(151)  评论(0编辑  收藏  举报

导航

新浪微博 新博客 Github