青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

C++研究

C++細節深度探索及軟件工程

  C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
  37 隨筆 :: 0 文章 :: 74 評論 :: 0 Trackbacks

 

The 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 First Arcticle: ABSTRACT FACTORY

Here the theory goes:

/*The theory basis :
  While using abstract factory , the  situation will be almost like this:
  we can create a real product from the abstract product , there are many series of product ,
  and the all have the similar property and operations , the operations can be different inner,
  but all the same interface outer;
  What's need?
  An abstract factory , and many real factory derived from this factory create real products
  An abstract product , any many real product derived from this proudct ;
  An abstract Interface , and many real Interface  that realize the interface
*/

Here the code goes:

 

  1/********************************************************************
  2created: 2007/04/18
  3created: 18:4:2007   0:42
  4filename:  C:\testvc6\TestStll\TestStll.cpp
  5file path: C:\testvc6\TestStll
  6file base: TestStll
  7file ext: cpp
  8author:  Chang xinglong(King.C)
  9
 10  purpose: Abstract Factory
 11*********************************************************************/

 12
 13
 14#include <iostream>
 15using namespace std;
 16
 17//the abstract implementation
 18class AbsProductImp 
 19{
 20public:
 21    virtual void DrawProductShape()=0;
 22}
;
 23//the abstract factory
 24class AbsFactory
 25{
 26public:
 27    virtual AbsProductImp * CreateAProductImp()=0;  //Create a real implement
 28}
;
 29
 30//the abstract product 
 31class AbsProduct
 32{
 33public:
 34    //virtual void DrawProductShape();
 35protected:
 36    AbsProductImp * _imp;  //implement pointer , it's decide which implement be execute
 37    AbsFactory * _Fac;// this pointer will point to the real factory 
 38    
 39}
;
 40// Derived begain [4/18/2007 Chang Xinglong(King.C)]
 41
 42class AProductImp :public AbsProductImp //the real a product
 43{
 44public:
 45    void DrawProductShape()
 46    {
 47        cout<<"A product is describing itselfA is implement complete "<<endl;
 48    }

 49    
 50}
;
 51class BProductImp :public AbsProductImp  //the real a product
 52{
 53public:
 54    virtual void DrawProductShape()
 55    {
 56        cout<<"B product is describing itselfB is implement complete "<<endl;
 57    }

 58    
 59}
;
 60// Derived the Factory [4/18/2007 Chang Xinglong(King.C)]
 61class AFactory :public AbsFactory//The factory that create A
 62{
 63public:
 64    virtual AbsProductImp * CreateAProductImp()
 65    {
 66        return new AProductImp;
 67    }

 68    
 69}
;
 70
 71class BFactory : public AbsFactory
 72{
 73public:
 74    virtual AbsProductImp * CreateAProductImp()
 75    {
 76        return new BProductImp;
 77    }

 78    
 79}
;
 80
 81class AProduct :public AbsProduct
 82{
 83public:
 84    AProduct()
 85    {
 86        _Fac=new AFactory; // specific the AFactory to create A
 87        _imp=_Fac->CreateAProductImp(); // polymorphism , select the product implement
 88        _imp->DrawProductShape(); //construct it self
 89    }

 90}
;
 91
 92class BProduct :public AbsProduct
 93{
 94public:
 95    BProduct()
 96    {
 97        _Fac=new BFactory; // specific the BFactory to create B
 98        _imp=_Fac->CreateAProductImp(); // polymorphism , select the product implement
 99        _imp->DrawProductShape(); //construct it self
100    }

101}
;
102// Derived the products [4/18/2007 Administrator]
103int main(int argc, char* argv[])
104{
105    AProduct _a;  //Create An AProduct
106    BProduct _b;  //Create A  BProduct
107    return 1;
108}

109
110
111
112
posted on 2007-04-18 02:26 常興龍 閱讀(995) 評論(2)  編輯 收藏 引用 所屬分類: Design Patterns & Engeering

評論

# re: Implement "GOF's Abstract Factory" Using C++(Series of Gof patterns using C++ 1st article) 2007-04-18 11:25 abware
GOF里的代碼就是C++的啊。  回復  更多評論
  

# re: Implement "GOF's Abstract Factory" Using C++(Series of Gof patterns using C++ 1st article) 2007-04-18 17:38 夢在天涯
雖然gof里有C++的實現,但是希望堅持寫下去,最好用平常我們生活中的實例,更淺顯易懂!
可以加入msn C++高級編程群:group2041@xiaoi.com  回復  更多評論
  

> hi的博客
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            免费欧美电影| 欧美亚洲第一页| 亚洲激情综合| 久久精品日韩欧美| 久久精品亚洲乱码伦伦中文| 亚洲欧美成人一区二区三区| 亚洲中午字幕| 翔田千里一区二区| 久久久噜噜噜久久人人看| 欧美成人精品三级在线观看| 欧美激情视频一区二区三区在线播放| 欧美激情欧美狂野欧美精品 | 国产一区视频观看| 在线精品视频一区二区| 亚洲精品女人| 午夜精品999| 久久尤物视频| 亚洲乱码一区二区| 欧美在线视频a| 欧美精品免费播放| 国产精品一区二区你懂的| 韩国三级在线一区| 亚洲性图久久| 美女国产一区| 亚洲性色视频| 国产欧美一区二区三区沐欲| 另类激情亚洲| 欧美激情国产日韩精品一区18| 亚洲国产精品日韩| 亚洲视屏一区| 欧美连裤袜在线视频| 国产日韩欧美一区二区三区四区| 亚洲激情成人在线| 亚洲一区三区视频在线观看| 蜜臀av性久久久久蜜臀aⅴ四虎| 99亚洲一区二区| 久久最新视频| 国产亚洲精品久久飘花| 亚洲一区区二区| 欧美激情精品久久久久久大尺度| 亚洲视频免费观看| 免费日本视频一区| 好吊色欧美一区二区三区四区| 亚洲免费在线| 亚洲免费成人av| 加勒比av一区二区| 午夜视频久久久| 午夜精品亚洲| 欧美日韩一区二区三区| 亚洲国产精品va在看黑人| 欧美在线影院| 亚洲一区二区高清视频| 欧美理论视频| 99国产精品久久久久久久久久 | 亚洲国产精品精华液2区45| 欧美一区二区黄| 亚洲一级在线观看| 欧美亚洲第一页| 亚洲婷婷免费| 亚洲小说欧美另类婷婷| 国产精品女人久久久久久| 亚洲在线1234| 亚洲一区二区四区| 国产精品人人做人人爽| 午夜亚洲福利在线老司机| 亚洲一级二级| 国产性做久久久久久| 欧美亚洲免费电影| 欧美亚洲一区| 在线免费不卡视频| 亚洲国产合集| 国产一区二区三区网站| 亚洲另类在线一区| 99re66热这里只有精品4| 国产精品久久看| 亚洲午夜黄色| 亚洲精品国产精品国产自| 欧美久久婷婷综合色| 亚洲欧美国产毛片在线| 欧美亚洲一区三区| 欧美激情久久久| 欧美一区日本一区韩国一区| 国产色综合网| 欧美1区2区3区| 欧美区在线播放| 欧美亚洲视频| 久久久久这里只有精品| 亚洲美女在线视频| 国产精品99久久久久久久久久久久| 国产精品美女久久久久av超清| 久久国产精品毛片| 免费av成人在线| 亚洲一区观看| 久久久久欧美精品| 亚洲婷婷综合久久一本伊一区| 午夜一区二区三视频在线观看| 在线视频成人| 亚洲综合首页| 亚洲精选中文字幕| 羞羞答答国产精品www一本| 亚洲国产高清aⅴ视频| 亚洲一区二区三区精品视频| 久久一区二区精品| 中文欧美在线视频| 亚洲欧美激情视频| 亚洲欧洲日产国产综合网| 亚洲永久在线观看| 亚洲精品在线免费| 久久久精品动漫| 午夜精品一区二区三区在线| 巨乳诱惑日韩免费av| 欧美制服第一页| 欧美日韩网址| 亚洲国产欧美日韩| 狠狠狠色丁香婷婷综合久久五月 | 国产农村妇女精品一区二区| 亚洲大胆女人| 国外视频精品毛片| 亚洲无亚洲人成网站77777| 亚洲精品久久在线| 久久久国产精彩视频美女艺术照福利| 亚洲天堂网在线观看| 欧美好吊妞视频| 欧美大片在线看| 国产在线播精品第三| 亚洲视频欧美视频| 亚洲午夜精品久久久久久浪潮| 久热精品视频在线观看一区| 欧美综合国产精品久久丁香| 国产精品美女www爽爽爽| 一区二区三区偷拍| 亚洲午夜电影网| 欧美日韩高清在线观看| 亚洲精品国精品久久99热| 亚洲国产专区| 欧美高清在线播放| 最新国产成人av网站网址麻豆| 亚洲电影下载| 免费日韩av电影| 亚洲激情婷婷| 一区二区激情视频| 欧美日韩小视频| 亚洲视频综合| 久久久青草青青国产亚洲免观| 国产欧美一区二区三区另类精品| 亚洲自拍啪啪| 久久综合色8888| 91久久久在线| 欧美午夜欧美| 欧美一乱一性一交一视频| 老司机凹凸av亚洲导航| 亚洲国产一区二区三区a毛片| 欧美激情国产日韩| 一区二区久久久久| 欧美淫片网站| 亚洲电影av在线| 欧美日韩午夜| 亚洲欧美日韩第一区| 久久男人资源视频| 亚洲经典在线| 国产精品女主播| 久久久久**毛片大全| 亚洲国产精品成人va在线观看| 一区二区欧美在线| 国产精品你懂的| 久久伊人免费视频| 日韩午夜三级在线| 久久久综合激的五月天| 亚洲人成啪啪网站| 亚洲国产欧美国产综合一区| 亚洲国产精品一区在线观看不卡 | 欧美日本韩国一区二区三区| 99在线精品视频| 久久久午夜精品| 亚洲免费电影在线| 国产精品一区2区| 美女视频黄a大片欧美| 一区二区三区欧美日韩| 免费成人黄色av| 亚洲欧美色一区| 亚洲激情av| 国产一区久久久| 欧美四级伦理在线| 免费美女久久99| 香蕉精品999视频一区二区| 亚洲福利小视频| 久久精品亚洲| 亚洲在线国产日韩欧美| 亚洲国产精品久久久久婷婷884| 国产精品久久久久国产精品日日| 久久婷婷影院| 亚洲欧美日韩国产综合在线 | 一本色道久久综合亚洲二区三区| 国产日韩欧美综合| 欧美三级在线播放| 欧美插天视频在线播放| 久久―日本道色综合久久| 亚洲一区二区三区精品视频| 亚洲精品永久免费| 亚洲国产精品视频|