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

C++研究

C++細(xì)節(jié)深度探索及軟件工程

  C++博客 :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
  37 隨筆 :: 0 文章 :: 74 評(píng)論 :: 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 常興龍 閱讀(1004) 評(píng)論(2)  編輯 收藏 引用 所屬分類: Design Patterns & Engeering

評(píng)論

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

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

> 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>
            欧美日韩一区二区三区免费看| 欧美日韩久久久久久| 国产精品久久久久久久app | 亚洲综合大片69999| 欧美视频免费在线| 亚洲欧美成人一区二区在线电影| 夜夜精品视频| 国产精品高潮呻吟久久av无限| 亚洲无线观看| 午夜精品99久久免费| 国产一区二区三区在线免费观看| 久久久蜜臀国产一区二区| 久久精品一区二区国产| 最新日韩中文字幕| 99亚洲精品| 国产视频一区在线观看一区免费| 久久综合网hezyo| 欧美成人午夜影院| 亚洲综合精品一区二区| 久久久www成人免费无遮挡大片| 亚洲高清一二三区| 99精品国产在热久久| 国产精品久线观看视频| 久久综合中文字幕| 欧美日韩福利视频| 久久久999成人| 欧美激情久久久| 欧美有码在线观看视频| 免费亚洲一区二区| 亚洲欧美影音先锋| 欧美~级网站不卡| 亚洲欧美日韩精品综合在线观看 | 久久亚洲一区二区三区四区| 久久精品国产清高在天天线| 99热在线精品观看| 午夜视频久久久久久| 日韩午夜av在线| 性做久久久久久久免费看| 亚洲三级免费观看| 午夜久久美女| 宅男66日本亚洲欧美视频| 久久久久久久综合日本| 亚洲综合成人在线| 欧美成人资源| 久久一区免费| 国产欧美日韩综合一区在线观看 | 亚洲一本视频| 欧美成人影音| 久久婷婷综合激情| 国产欧美精品日韩精品| 99精品视频免费观看| 最新成人av在线| 久久久久久亚洲精品中文字幕| 亚洲一区二三| 欧美日韩国产色视频| 欧美福利视频网站| 红桃视频亚洲| 欧美怡红院视频一区二区三区| 亚洲图片你懂的| 欧美精品一区在线播放| 欧美国产日韩精品免费观看| 国产亚洲精品一区二555| 亚洲一区二区三区四区五区黄| 亚洲视频播放| 欧美日韩一区二区三区| 日韩一级免费| 亚洲视频在线一区| 99视频精品全部免费在线| 亚洲精品一二三区| 欧美韩国日本综合| 亚洲精品视频在线观看免费| 欧美超级免费视 在线| 裸体歌舞表演一区二区| 国内偷自视频区视频综合| 欧美一二三视频| 久久精品国产99精品国产亚洲性色| 国产精品入口| 亚洲欧美韩国| 久久久www成人免费无遮挡大片 | 欧美精品一区二区三区在线看午夜 | 久久精品一二三| 看片网站欧美日韩| 亚洲国产精品日韩| 欧美激情一区二区三区在线视频 | 欧美一区在线视频| 国产午夜精品理论片a级探花 | 欧美一区二区三区精品电影| 国产精品一区二区久久国产| 性做久久久久久久久| 久久―日本道色综合久久| 136国产福利精品导航| 欧美高清视频一区二区| 一个人看的www久久| 国产精品一级二级三级| 久久国产精品一区二区| 亚洲成色最大综合在线| 亚洲日本中文| 一区二区三区四区国产| 欧美婷婷久久| 久久国产精品久久久久久久久久 | 日韩亚洲国产精品| 亚洲一区二区三区国产| 麻豆精品精华液| 亚洲视频www| 一区精品久久| 国产精品国产三级国产普通话三级| 久久av免费一区| 亚洲靠逼com| 久久久久久一区二区| 亚洲精品中文字幕在线| 国产香蕉久久精品综合网| 亚洲国产欧美另类丝袜| 久久精品国产亚洲一区二区三区| 91久久精品国产91久久性色| 国产精品资源| 欧美日韩1区2区| 欧美伊人久久久久久午夜久久久久| 亚洲黄色视屏| 麻豆91精品| 欧美在线观看视频一区二区| 欧美日韩a区| 久热精品在线视频| 欧美一区二区三区视频| 日韩视频精品在线观看| 欧美+日本+国产+在线a∨观看| 亚洲影院污污.| 日韩视频一区二区三区在线播放| 国产一区二区av| 欧美视频一二三区| 欧美精品黄色| 欧美xx69| 亚洲激情视频在线播放| 裸体歌舞表演一区二区| 久久国产一区二区| 亚洲综合首页| 亚洲一区日韩在线| 欧美亚洲视频一区二区| 蜜桃av久久久亚洲精品| 久久蜜桃精品| 久久久99免费视频| 久久久夜夜夜| 久久成年人视频| 欧美在线观看一区二区三区| 亚洲欧美一区二区在线观看| 一区二区三区导航| 在线午夜精品自拍| 一区二区三区欧美在线| 日韩网站在线看片你懂的| 亚洲国产精品毛片| 亚洲国产成人高清精品| 亚洲国产精品www| 最新国产乱人伦偷精品免费网站| 欧美激情精品久久久| 亚洲大片在线| 亚洲美女精品成人在线视频| 亚洲日本欧美| 一本到12不卡视频在线dvd| 一本色道久久综合亚洲二区三区| a4yy欧美一区二区三区| 一区二区三区久久| 亚洲欧美另类久久久精品2019| 午夜日韩在线| 久久偷看各类wc女厕嘘嘘偷窃| 免费观看在线综合色| 欧美女同在线视频| 国产精品第一区| 国产一区二区三区免费在线观看| 国产亚洲欧美中文| 亚洲高清久久久| 亚洲桃花岛网站| 久久激情一区| 亚洲大胆视频| 亚洲一区区二区| 麻豆成人综合网| 国产精品啊啊啊| 尤物在线精品| 中文国产成人精品| 久久久久久久欧美精品| 亚洲高清资源| 午夜久久黄色| 欧美高清在线一区二区| 99日韩精品| 久久久久久免费| 欧美性天天影院| 亚洲国产高清在线| 亚洲影视九九影院在线观看| 蜜桃av噜噜一区| 亚洲一级黄色av| 美女主播精品视频一二三四| 国产精品国产三级国产aⅴ9色| 久久国产精品久久国产精品| 欧美日韩精品二区| 一区二区三区我不卡| 亚洲一区二区三区中文字幕| 久久综合网色—综合色88| 亚洲美女视频在线观看| 久久综合婷婷| 国产亚洲精品久| 午夜精彩视频在线观看不卡| 欧美第一黄网免费网站|