<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # 借用構造函數繼承(call繼承,經典繼承) <br> >[danger]構造函數.call(當前對象,參數,參數..) **** window.構造函數.call(當前對象,參數,參數..) window可以省略 ***** **只能獲取屬性,不能獲取方法** ```javascript //?構造函數?Person functionPerson(name,age){ this.name=name; this.age=age; this.eat=function(){ console.log("吃飯"); } }; //?方法掛原型上 Person.prototype.say=function(){ console.log("世界,你好"); } //?構造函數Student functionStudent(name,age,score){ Person.call(this,name,age); //call繼承,繼承Person方法中的屬性,在這里省略了window不寫???window.Person.call(this) this.score=score; } //?實例化對象 var?stu1?=newStudent("小明",3,100); console.log(stu1); console.log(stu1.name); stu1.eat();//可以拿到Person上的方法 stu1.say();//call??拿不到Person原型上的方法 ``` <br> ## 缺陷 **借用構造函數沒有辦法拿到借用函數原型上的方法,只能獲取借用構造函數上的私有屬性** **使用混合式繼承解決**
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看