Parent.call(this); Parent2.call(this);

  <script type="text/javascript">
 
    function Parent(){
        this.add=function(a,b){alert(a+b);}
    }

    function Parent2(){
        this.sub=function(a,b){alert(a-b);}
    }

    function Child(){
        Parent.call(this);
        Parent2.call(this);
    }

    var cls=new Child();
    cls.add(2,3);
    cls.sub(5,3);

  </script>

 

posted @ 2017-11-29 22:02  sky20080101  阅读(89)  评论(0)    收藏  举报