<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>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 接口隔離原則 含義:客戶端不應該依賴它不需要的接口,一個類對另一個類的依賴應該建立在最小的接口上。(來自百度百科) 舉個栗子: 現在有一個考試類,上面有考試接口,分別是考語數外、理化生、政史地等接口。現在有文科學生類和理科學生類分別繼承考試類,實現考試類的接口進行考試。這里就有些違反接口隔離原則了,因為文科學生并不需要考物理化,理科學生也并不需要考政史地。 解決: 對考試接口進行細化,文科考試接口和理科考試接口;文科生、理科生另外各自實現文科考試接口、理科考試接口。 ~~~ // 文科考試接口 class ArtsExam{ constructor(name) { this.name = name } exam() { console.log(`我是${this.name}我要參加考語數外歷史地理政治`) } } // 理科考試接口 class ScienceExam{ constructor(name) { this.name = name } exam() { console.log(`我是${this.name}我要參加考語數外物理化學生物`) } } // 文科學生 class Arts extends ArtsExam{     constructor(name){        super(name)   } } // 理科學生 class Science extends ScienceExam{ constructor(name){ super(name) } } student1=new Arts("文科生小紅") student1.exam()// 我是文科生小紅我要參加考語數外歷史地理政治 student2=new Science("理科生小明") student2.exam()// 我是理科生小明我要參加考語數外物理化學生物 ~~~
                  <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>

                              哎呀哎呀视频在线观看