锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产成人精品无码久久久久久综合 ,久久久久久亚洲精品不卡,99久久综合国产精品免费http://m.shnenglu.com/cxl82116/category/4115.html錛?+緇嗚妭娣卞害鎺㈢儲(chǔ)鍙?qiáng)枋Y浠跺伐紼?/description>zh-cnMon, 19 May 2008 21:38:45 GMTMon, 19 May 2008 21:38:45 GMT60Implement "GOF's Builder pattern" Using C++(Series of Gof patterns using C++ 4th article) http://m.shnenglu.com/cxl82116/archive/2007/06/02/25339.html灝忛緳鍝?/dc:creator>灝忛緳鍝?/author>Sat, 02 Jun 2007 09:34:00 GMThttp://m.shnenglu.com/cxl82116/archive/2007/06/02/25339.htmlhttp://m.shnenglu.com/cxl82116/comments/25339.htmlhttp://m.shnenglu.com/cxl82116/archive/2007/06/02/25339.html#Feedback4http://m.shnenglu.com/cxl82116/comments/commentRss/25339.htmlhttp://m.shnenglu.com/cxl82116/services/trackbacks/25339.htmlWelcome every one to express his ideas!
  闃呰鍏ㄦ枃

]]>
Implement "GOF's Bridge pattern" Using C++(Series of Gof patterns using C++ 3rd article) http://m.shnenglu.com/cxl82116/archive/2007/04/24/22689.html灝忛緳鍝?/dc:creator>灝忛緳鍝?/author>Mon, 23 Apr 2007 18:38:00 GMThttp://m.shnenglu.com/cxl82116/archive/2007/04/24/22689.htmlhttp://m.shnenglu.com/cxl82116/comments/22689.htmlhttp://m.shnenglu.com/cxl82116/archive/2007/04/24/22689.html#Feedback0http://m.shnenglu.com/cxl82116/comments/commentRss/22689.htmlhttp://m.shnenglu.com/cxl82116/services/trackbacks/22689.html闃呰鍏ㄦ枃

]]>
Implement "GOF's Adapter pattern" Using C++(Series of Gof patterns using C++ 2nd article) http://m.shnenglu.com/cxl82116/archive/2007/04/21/22513.html灝忛緳鍝?/dc:creator>灝忛緳鍝?/author>Sat, 21 Apr 2007 11:13:00 GMThttp://m.shnenglu.com/cxl82116/archive/2007/04/21/22513.htmlhttp://m.shnenglu.com/cxl82116/comments/22513.htmlhttp://m.shnenglu.com/cxl82116/archive/2007/04/21/22513.html#Feedback4http://m.shnenglu.com/cxl82116/comments/commentRss/22513.htmlhttp://m.shnenglu.com/cxl82116/services/trackbacks/22513.htmlThe Gof has 23 design patterns , but in most of  the design books , the E.G is written in Java , So  from now on , I will write about 23 articles to implement them using C++ , the design pattern itself is discussible , so welcome everyone to give his excelent idea to me , My QQ: 286259397 And My MSN : cxl82116@msn.com.
Welcome every one to express his ideas!

 


This is the Second Arcticle: ADAPTER PATTERN

While
referring to Adapter pattern , there must be a class that play the role of a adapter which can make two or more umcompatible class compatible . To explain this world , the UML diagram can make it clear easily :


        diagram 2-1 Class Adapter UML (referred from http://terrylee.cnblogs.com)


        diagram 2-2  Object Adapter UML (referred from http://terrylee.cnblogs.com)


E.G Explain them sparetely:
if a Customer request a  CUP WITH A CAP , but the orgin system can only supply a CUP , So you it's not compatible between the Request and the Orgin System , so you must find anthor factory who supply the cap ,and make it together to statisfy the customer ,  implement it in Class Adapter Pattern , Codes goes below.
Class Adapter Pattern:

 1/********************************************************************
 2    created:    2007/04/21
 3    created:    21:4:2007   18:47
 4    filename:     c:\Visual Studio 2005\Projects\Frist2005\Frist2005\Frist2005.cpp
 5    file path:    c:\Visual Studio 2005\Projects\Frist2005\Frist2005
 6    file base:    Frist2005
 7    file ext:    cpp
 8    author:        Chang Xinglong(King.C)
 9    
10    purpose:    Adapter Pattern -Class
11*********************************************************************/

12
13#include "stdafx.h"
14#include <map>
15#include <iostream>
16
17using namespace std;
18
19class OrginSystem
20{
21
22public:
23    void Supply()
24    {
25        cout<<"Orgin:SupplyACup"<<endl;
26    }

27}
;
28class CapSystem
29{
30public:
31    void Supply()
32    {
33        cout<<"CapSystem:SupplyACap"<<endl;
34    }

35}
;
36class Adapter: public OrginSystem , CapSystem
37{
38public:
39    void Supply()
40    {
41        OrginSystem::Supply();
42        CapSystem::Supply();
43        cout<<"So the request has been satisfied!"<<endl;
44    }

45}
;
46int _tmain(int argc, _TCHAR* argv[])
47{
48    Adapter _adpter;
49    _adpter.Supply();
50    system("pause");
51    return 0;
52}

The Same question , implement it using Object Adapter Pattern:
 1/********************************************************************
 2    created:    2007/04/21
 3    created:    21:4:2007   18:47
 4    filename:     c:\Visual Studio 2005\Projects\Frist2005\Frist2005\Frist2005.cpp
 5    file path:    c:\Visual Studio 2005\Projects\Frist2005\Frist2005
 6    file base:    Frist2005
 7    file ext:    cpp
 8    author:        Chang Xinglong(King.C)
 9    
10    purpose:    Adapter Pattern-Object 
11*********************************************************************/

12
13#include "stdafx.h"
14#include <map>
15#include <iostream>
16
17using namespace std;
18
19class OrginSystem
20{
21
22public:
23    void Supply()
24    {
25        cout<<"Orgin:SupplyACup"<<endl;
26    }

27}
;
28class CapSystem
29{
30public:
31    void Supply()
32    {
33        cout<<"CapSystem:SupplyACap"<<endl;
34    }

35}
;
36class Adapter: public OrginSystem , CapSystem
37{
38public:
39    Adapter():_os(new OrginSystem),_cs(new CapSystem)
40    {
41
42    }

43    void Supply()
44    {
45        _os->Supply();
46        _cs->Supply();
47        cout<<"So the request has been satisfied!"<<endl;
48    }

49private:
50    OrginSystem *_os;
51    CapSystem * _cs;
52}
;
53int _tmain(int argc, _TCHAR* argv[])
54{
55    OrginSystem _orign=new _adpter();
56    _orign.Supply();
57    system("pause");
58    return 0;
59}

60
61

In C++ , Muiltple-Derived pattern is not a recommend pattern, So if possible , use the Obeject -Adpter Pattern.

That's all ,Thanks! if any different idea , send me E-mail.


]]>
Implement "GOF's Abstract Factory" Using C++(Series of Gof patterns using C++ 1st article)http://m.shnenglu.com/cxl82116/archive/2007/04/18/22183.html灝忛緳鍝?/dc:creator>灝忛緳鍝?/author>Tue, 17 Apr 2007 18:26:00 GMThttp://m.shnenglu.com/cxl82116/archive/2007/04/18/22183.htmlhttp://m.shnenglu.com/cxl82116/comments/22183.htmlhttp://m.shnenglu.com/cxl82116/archive/2007/04/18/22183.html#Feedback2http://m.shnenglu.com/cxl82116/comments/commentRss/22183.htmlhttp://m.shnenglu.com/cxl82116/services/trackbacks/22183.html闃呰鍏ㄦ枃

]]>
亚洲Av无码国产情品久久| 蜜臀av性久久久久蜜臀aⅴ麻豆| 国产成人精品久久一区二区三区av | 久久精品国产亚洲av麻豆小说| 999久久久无码国产精品| 久久久久久国产a免费观看不卡| 精品久久久久久国产| 久久精品国产精品亚洲人人| 色欲综合久久中文字幕网| 精品久久久久久久久久久久久久久| 亚洲色欲久久久久综合网 | avtt天堂网久久精品| 伊人情人综合成人久久网小说| 狠狠色噜噜狠狠狠狠狠色综合久久| 日韩亚洲国产综合久久久| 久久久久久免费一区二区三区| 久久这里只精品99re66| 国産精品久久久久久久| 国产精品美女久久久久久2018| 九九精品久久久久久噜噜| 久久成人永久免费播放| 国产美女久久精品香蕉69| 久久久久久综合网天天| 中文国产成人精品久久亚洲精品AⅤ无码精品 | 国产精品xxxx国产喷水亚洲国产精品无码久久一区 | 久久精品成人一区二区三区| 九九精品99久久久香蕉| 模特私拍国产精品久久| 亚洲伊人久久综合影院| 久久强奷乱码老熟女网站| 亚洲国产成人久久综合一| 久久99毛片免费观看不卡| 久久精品一本到99热免费| 无码专区久久综合久中文字幕 | 丁香久久婷婷国产午夜视频| 久久er国产精品免费观看2| 久久亚洲国产成人精品性色| 国产麻豆精品久久一二三| 国产精品免费福利久久| 亚洲午夜久久久精品影院| 久久99精品国产麻豆婷婷|