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

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 常興龍 閱讀(991) 評論(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>
            亚洲一本大道在线| 午夜精品影院| 国产精品久久久久高潮| 欧美激情精品久久久久久大尺度| 美女主播一区| 欧美日韩1区2区3区| 欧美日韩在线播放一区二区| 国产精品人成在线观看免费 | 一区二区在线观看视频| 国产午夜精品一区二区三区视频| 国产欧美日韩视频一区二区三区| 国产一本一道久久香蕉| 在线观看91精品国产入口| 亚洲区免费影片| 亚洲一区二区三区三| 新67194成人永久网站| 久久久久久网址| 亚洲国产精品一区二区尤物区| 亚洲国产女人aaa毛片在线| 一本色道久久综合亚洲精品高清| 午夜精品电影| 欧美国产视频在线| 国产精品腿扒开做爽爽爽挤奶网站| 国产日韩视频| 日韩午夜电影在线观看| 亚久久调教视频| 亚洲电影中文字幕| 亚洲香蕉成视频在线观看| 久久一区二区视频| 国产精品视频不卡| 日韩写真在线| 久久综合色影院| 亚洲午夜av| 欧美精品久久久久a| 亚洲国产激情| 久久九九免费视频| 欧美承认网站| 欧美一区二区三区婷婷月色| 欧美区国产区| 亚洲高清三级视频| 久久av老司机精品网站导航| 亚洲人成7777| 蜜臀va亚洲va欧美va天堂| 国产日韩精品一区二区| 中文国产一区| 亚洲国产视频一区| 久久全球大尺度高清视频| 国产偷国产偷亚洲高清97cao| 一区二区三区欧美日韩| 欧美激情aⅴ一区二区三区| 久久黄色级2电影| 国产亚洲精品久久飘花| 欧美一区二区三区精品| 亚洲天堂av在线免费观看| 欧美精品一区二区精品网| 亚洲第一福利社区| 欧美成人一区二区三区| 久久久久久久久久久久久女国产乱| 国产精品夜夜夜一区二区三区尤| 亚洲在线观看视频| 在线视频一区二区| 国产精品毛片在线看| 亚洲欧美视频在线观看| 亚洲一区二区三区免费在线观看| 国产精品二区影院| 欧美在线观看一二区| 欧美一级专区免费大片| 国产一区二区三区的电影 | 欧美黄色小视频| 亚洲三级国产| 亚洲理论在线| 国产精品国产自产拍高清av| 午夜欧美理论片| 欧美在线精品一区| 亚洲福利视频专区| 日韩午夜在线观看视频| 国产精品电影在线观看| 久久国产精品久久精品国产| 欧美在线观看视频一区二区| 亚洲高清资源| 一区二区免费在线观看| 国产欧美综合一区二区三区| 久久亚洲精选| 欧美精品免费看| 欧美一区二区高清| 久久久最新网址| av成人手机在线| 亚洲欧美一区二区视频| 亚洲第一综合天堂另类专| 亚洲欧洲日韩综合二区| 国产精品日韩在线| 欧美成年人视频网站欧美| 欧美日韩国产区一| 国产九色精品成人porny| 国产亚洲制服色| 亚洲欧洲一区| 国产一区二区久久| 亚洲国内自拍| 国产麻豆精品久久一二三| 欧美成人午夜激情视频| 欧美视频不卡| 欧美18av| 国产精品手机视频| 亚洲福利视频在线| 国产午夜精品久久久| 亚洲激情亚洲| 国产一区视频在线观看免费| 最新国产成人av网站网址麻豆| 国产视频一区二区在线观看 | 亚洲激情综合| 狠狠色丁香婷综合久久| 一级日韩一区在线观看| 亚洲人成网在线播放| 久久黄色小说| 久久久精品五月天| 国产精品高潮呻吟久久av黑人| 亚洲国产导航| 亚洲第一毛片| 欧美伊人久久久久久久久影院| 亚洲视频一区二区| 欧美福利在线观看| 欧美国产综合视频| 樱桃国产成人精品视频| 亚洲欧美日韩爽爽影院| 亚洲在线观看| 欧美小视频在线观看| 91久久精品美女| 亚洲三级色网| 欧美精品在线免费观看| 亚洲国产日韩欧美一区二区三区| 狠狠综合久久av一区二区老牛| 亚洲制服av| 午夜精品免费视频| 欧美午夜精品久久久久久浪潮 | 国产精品久久久久久久久久免费看| 欧美韩日高清| 亚洲国产视频一区| 免费久久99精品国产自在现线| 久久久夜夜夜| 黄色精品网站| 蜜臀99久久精品久久久久久软件| 免费精品视频| 最新成人在线| 欧美日韩999| 亚洲视频福利| 久久久久国产一区二区三区四区| 国产美女精品视频免费观看| 亚洲香蕉网站| 久久人人精品| 亚洲欧洲在线视频| 欧美日韩国产亚洲一区| 一区二区三区欧美在线观看| 午夜精品久久久久久久99黑人| 国产精品男女猛烈高潮激情 | 国产精品无码专区在线观看| 亚洲一区二三| 久久夜色精品国产欧美乱| 亚洲高清久久久| 欧美日韩国产欧美日美国产精品| 亚洲深夜福利在线| 蜜臀久久99精品久久久久久9 | 亚洲乱码国产乱码精品精天堂 | 美玉足脚交一区二区三区图片| 亚洲国产精品va在看黑人| 欧美日本一区| 午夜精品久久久久久久99热浪潮| 久久一区二区三区四区| 亚洲精品乱码久久久久久日本蜜臀| 欧美日韩成人免费| 午夜影院日韩| 亚洲精品乱码久久久久久黑人| 久久成人免费网| 亚洲精品中文字幕女同| 国产伦精品一区二区三区视频黑人| 久久视频在线视频| 国产精品99久久久久久久久| 免费91麻豆精品国产自产在线观看| 日韩亚洲欧美一区| 国产一区在线播放| 欧美日韩国产精品一卡| 久久精品二区三区| 夜夜嗨av一区二区三区四季av| 久久午夜av| 午夜日韩电影| 夜色激情一区二区| 在线欧美小视频| 国产毛片久久| 欧美网站在线| 欧美久久综合| 久久亚洲一区二区三区四区| 亚洲一区二区三区国产| 91久久一区二区| 欧美福利视频| 久久尤物视频| 久久精品99久久香蕉国产色戒| 99国产精品国产精品久久| 伊人激情综合| 精品不卡一区| 韩日欧美一区| 激情久久综艺|