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

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>
            亚洲第一视频网站| 老巨人导航500精品| 亚洲欧美日韩国产| 午夜欧美理论片| 欧美电影免费观看大全| 国产日韩欧美在线| 永久免费毛片在线播放不卡| 99在线|亚洲一区二区| 久久成人av少妇免费| 久久久久久穴| 亚洲一区二区久久| 欧美久久久久久| 1024国产精品| 久久久久久尹人网香蕉| 美女免费视频一区| 亚洲电影成人| 99re66热这里只有精品4| 欧美激情第4页| 亚洲国产欧美在线| 免费观看在线综合| 久久精品一本| 国产一区二区无遮挡| 久久激情一区| 国内精品久久久久久影视8| 日韩视频在线一区二区| 欧美mv日韩mv国产网站| 久久精品网址| 99热精品在线观看| 午夜在线播放视频欧美| 国产欧美一区二区三区在线看蜜臀| 一区二区欧美亚洲| 99视频精品在线| 欧美精品国产精品| 亚洲天堂网在线观看| 亚洲精品日韩精品| 欧美日韩一级大片网址| 亚洲一区二区影院| 欧美一级黄色网| 伊人色综合久久天天五月婷| 99在线|亚洲一区二区| 在线成人国产| 影音先锋中文字幕一区二区| 国产精品高精视频免费| 亚洲国产成人久久综合一区| 久久久久久国产精品mv| 久久精品99久久香蕉国产色戒| 国产午夜精品久久久久久免费视| 亚洲黄色在线视频| 欧美理论大片| 欧美成人激情视频免费观看| 国产欧美日本一区二区三区| 亚洲精品自在久久| 日韩午夜免费| 欧美大片网址| 日韩一区二区精品葵司在线| 久久午夜羞羞影院免费观看| 99精品欧美一区二区蜜桃免费| 久久久久综合| 亚洲自拍偷拍网址| 欧美日韩三区四区| 亚洲另类黄色| 久久久久久999| 国产日韩专区| 欧美自拍偷拍| 一区二区国产精品| 欧美连裤袜在线视频| 亚洲精品乱码久久久久久黑人| 欧美日韩国产丝袜另类| 羞羞视频在线观看欧美| 久久亚洲影院| 欧美风情在线观看| 亚洲免费久久| 久久九九精品| 免费不卡中文字幕视频| 亚洲国产99| 欧美日韩国产综合一区二区| 一区二区三区不卡视频在线观看| 在线观看日产精品| 免费在线日韩av| 久久久久久九九九九| 国产一区二区三区在线免费观看| 西瓜成人精品人成网站| 麻豆国产精品一区二区三区| 亚洲精品日本| 久久久www| 亚洲国产精品一区二区久| 激情小说另类小说亚洲欧美 | 欧美看片网站| 亚洲性感美女99在线| 最新国产拍偷乱拍精品| 久久婷婷国产麻豆91天堂| 亚洲国产日韩在线一区模特| 亚洲一本大道在线| 欧美精品在线视频| 小黄鸭精品密入口导航| 老司机一区二区三区| 99av国产精品欲麻豆| 国产日韩欧美在线看| 欧美国产成人精品| 午夜精品久久久久久久99樱桃 | 在线播放日韩欧美| 欧美色欧美亚洲高清在线视频| 亚洲欧洲视频在线| 久久riav二区三区| 一本色道久久综合亚洲精品不 | 99国产一区| 国产亚洲精品高潮| 欧美日韩视频第一区| 久久三级福利| 亚洲欧美激情诱惑| 欧美一区二区在线免费观看| 国产美女精品免费电影| 亚洲欧美日韩在线| 亚洲人成啪啪网站| 巨乳诱惑日韩免费av| 欧美一区二粉嫩精品国产一线天| 亚洲日本视频| 精品成人一区二区| 国产欧美在线观看一区| 欧美日韩系列| 欧美精品一级| 女人天堂亚洲aⅴ在线观看| 欧美一区1区三区3区公司| 一本色道久久88精品综合| 在线观看欧美黄色| 亚洲日韩视频| 久久一区二区三区国产精品| 国产精品多人| 欧美韩日高清| 麻豆精品在线观看| 久久久久这里只有精品| 小辣椒精品导航| 亚洲欧美综合v| 亚洲夜晚福利在线观看| 国产精品99久久99久久久二8| 欧美在线观看视频| 亚洲欧美视频在线观看视频| 亚洲午夜激情| 亚洲婷婷综合色高清在线| 亚洲最新中文字幕| 在线亚洲电影| 亚洲一本大道在线| 亚洲欧美日韩国产综合在线| 亚洲一品av免费观看| 亚洲伊人网站| 午夜精品理论片| 久久成人精品一区二区三区| 久久成人精品| 毛片基地黄久久久久久天堂| 蜜桃精品一区二区三区| 欧美国产日韩免费| 午夜精品在线| 久久精品视频在线观看| 久久久最新网址| 欧美成人中文字幕| 亚洲精品影视在线观看| 中文亚洲欧美| 欧美在线精品免播放器视频| 久久人人97超碰国产公开结果 | 亚洲综合成人在线| 欧美在线播放一区| 欧美sm视频| 国产精品va在线| 欧美激情1区2区| 欧美日韩伦理在线| 国产日韩欧美综合| 亚洲日本电影| 亚洲综合欧美| 美女黄毛**国产精品啪啪| 91久久精品国产| 亚洲一级二级在线| 久久乐国产精品| 欧美网站在线观看| 国内伊人久久久久久网站视频| 国产精品日韩电影| 欧美午夜精品理论片a级按摩| 国产日韩欧美夫妻视频在线观看| 亚洲国产高清在线观看视频| 亚洲午夜久久久| 老牛嫩草一区二区三区日本| 亚洲美女视频在线观看| 久久久www成人免费无遮挡大片| 欧美激情一区二区三区在线 | 欧美精品一区二区三区蜜臀| 国产精品色婷婷| 亚洲精选视频在线| 久久久精品免费视频| 999亚洲国产精| 美女网站久久| 国产在线精品一区二区夜色| 一区二区欧美精品| 欧美高清一区| 久久99伊人| 国产精品地址| 亚洲美女黄色| 美女视频一区免费观看| 亚洲欧美成人一区二区三区| 欧美另类专区| 亚洲精品国产无天堂网2021| 狂野欧美激情性xxxx欧美|