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

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                ## 模式定義: 外觀模式提供了一個統一的接口,用來訪問子系統中的一群接口。外觀定義了一個高層接口,讓子系統更容易使用。 ## 模式結構: ![](https://box.kancloud.cn/2016-08-30_57c545909cbf5.jpg) ## 舉例: 構造一個家庭影院,當啟動watchMovie方法時可以看電影,當使用endMovie時關閉電影。 ## 編程實現及執行結果: ~~~ #include <iostream> using namespace std; //組件類 class Amplifier { public: void on() { cout << "Amplifier on" << endl; } void off() { cout << "Amplifier off" << endl; } }; class Tuner { public: void on() { cout << "Tuner on" << endl; } void off() { cout << "Tuner off" << endl; } }; class DvdPlayer { public: void on() { cout << "DvdPlayer on" << endl; } void off() { cout << "DvdPlayer off" << endl; } }; class Screen { public: void on() { cout << "Screen on" << endl; } void off() { cout << "Screen off" << endl; } }; //家庭影院 class HomeTheaterFacade { public: //統一接口 void watchMovie() { amp.on(); tuner.on(); dvd.on(); screen.on(); } void endMovie() { amp.off(); tuner.off(); dvd.off(); screen.off(); } HomeTheaterFacade(Amplifier am, Tuner tune, DvdPlayer dv, Screen scree) { amp = am; tuner = tune; dvd = dv; screen = scree; } //~HomeTheaterFacade(){} private: Amplifier amp; Tuner tuner; DvdPlayer dvd; Screen screen; }; //客戶代碼 int main() { Amplifier amp; Tuner tuner; DvdPlayer dvd; Screen screen; HomeTheaterFacade homeTheaterFacade(amp,tuner,dvd,screen);; homeTheaterFacade.watchMovie(); homeTheaterFacade.endMovie(); return 0; } ~~~ 執行結果: **Amplifieron** **Tuneron** **DvdPlayeron** **Screenon** **Amplifieroff** **Tuneroff** **DvdPlayeroff** **Screenoff** **請按任意鍵繼續. . .** ## 設計原則: 最少知識原則:只和你的密友談話
                  <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>

                              哎呀哎呀视频在线观看