| 订阅 | 在线投稿
分享
 
 
当前位置: 王朝网络 >> c/c++ >> C++ zhong de xu han shu (virtual function)(1)

C++ zhong de xu han shu (virtual function)(1)

2008-06-01 02:06:36 编辑來源:互联网 评论
 
 
 
本文为【C++中的虚函数(virtual function)(1)】的拼音翻译版
  yi . jian jie
  xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci :
  class A
  {
  public:
  virtual void foo() { cout << "A::foo() is called" << endl;}
  };
  class B: public A
  {
  public:
  virtual void foo() { cout << "B::foo() is called" << endl;}
  };
  na me , zai shi yong de shi hou , wo men ke yi :
  A * a = new B();
  a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de !
  zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。
  xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de :
  class A
  {
  public:
  virtual void foo();
  };
  class B: public A
  {
  virtual void foo();
  };
  void bar()
  {
  A a;
  a.foo(); // A::foo() bei tiao yong
  }
  1.1 duo tai
  zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie :
  void bar(A * a)
  {
  a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()?
  }
  yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。
  zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。
  1.2 duo tai you shen me yong ?
  duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。
  zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。
  duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。
  1.3 ru he “ dong tai lian bian ”
  bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。
  wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi :
  void bar(A * a)
  {
  a->foo();
  }
  hui bei gai xie wei :
  void bar(A * a)
  {
  (a->vptr[1])();
  }
  yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。
  sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。
  1.4 overload he override
  xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia :
  override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。
  overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。
  yi . jian jie
  
  
  xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci :
  class A
  {
  public:
  virtual void foo() { cout << "A::foo() is called" << endl;}
  };
  class B: public A
  {
  public:
  virtual void foo() { cout << "B::foo() is called" << endl;}
  };
  na me , zai shi yong de shi hou , wo men ke yi :
  A * a = new B();
  a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de !
  zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。
  xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de :
  class A
  {
  public:
  virtual void foo();
  };
  class B: public A
  {
  virtual void foo();
  };
  void bar()
  {
  A a;
  a.foo(); // A::foo() bei tiao yong
  }
  1.1 duo tai
  zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie :
  void bar(A * a)
  {
  a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()?
  }
  yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。
  zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。
  1.2 duo tai you shen me yong ?
  duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。
  zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。
  duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。
  1.3 ru he “ dong tai lian bian ”
  bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。
  wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi :
  void bar(A * a)
  {
  a->foo();
  }
  hui bei gai xie wei :
  void bar(A * a)
  {
  (a->vptr[1])();
  }
  yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。
  sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。
  1.4 overload he override
  xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia :
  override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。
  overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.Html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan
  yi . jian jie
  
  
  xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci :
  class A
  {
  public:
  virtual void foo() { cout << "A::foo() is called" << endl;}
  };
  class B: public A
  {
  public:
  virtual void foo() { cout << "B::foo() is called" << endl;}
  };
  na me , zai shi yong de shi hou , wo men ke yi :
  A * a = new B();
  a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de !
  zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。
  xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de :
  class A
  {
  public:
  virtual void foo();
  };
  class B: public A
  {
  virtual void foo();
  };
  void bar()
  {
  A a;
  a.foo(); // A::foo() bei tiao yong
  }
  1.1 duo tai
  zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie :
  void bar(A * a)
  {
  a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()?
  }
  yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。
  zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。
  1.2 duo tai you shen me yong ?
  duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。
  zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。
  duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。
  1.3 ru he “ dong tai lian bian ”
  bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。
  wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi :
  void bar(A * a)
  {
  a->foo();
  }
  hui bei gai xie wei :
  void bar(A * a)
  {
  (a->vptr[1])();
  }
  yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。
  sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。
  1.4 overload he override
  xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia :
  override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。
  overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan
  yi . jian jie
  
  
  xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci :
  class A
  {
  public:
  virtual void foo() { cout << "A::foo() is called" << endl;}
  };
  class B: public A
  {
  public:
  virtual void foo() { cout << "B::foo() is called" << endl;}
  };
  na me , zai shi yong de shi hou , wo men ke yi :
  A * a = new B();
  a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de !
  zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。
  xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de :
  class A
  {
  public:
  virtual void foo();
  };
  class B: public A
  {
  virtual void foo();
  };
  void bar()
  {
  A a;
  a.foo(); // A::foo() bei tiao yong
  }
  1.1 duo tai
  zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie :
  void bar(A * a)
  {
  a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()?
  }
  yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。
  zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。
  1.2 duo tai you shen me yong ?
  duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。
  zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。
  duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。
  1.3 ru he “ dong tai lian bian ”
  bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。
  wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi :
  void bar(A * a)
  {
  a->foo();
  }
  hui bei gai xie wei :
  void bar(A * a)
  {
  (a->vptr[1])();
  }
  yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。
  sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。
  1.4 overload he override
  xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia :
  override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。
  overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan
  
   right"( chu chu : qing feng ruan jian xia zai xue yuan )【原文】【汉音对照
 
 
 
 
 
 
 
 
 
日版宠物情人插曲《Winding Road》歌词

日版宠物情人2017的插曲,很带节奏感,日语的,女生唱的。 最后听见是在第8集的时候女主手割伤了,然后男主用嘴帮她吸了一下,插曲就出来了。 歌手:Def...

兄弟共妻,我成了他们夜里的美食

老钟家的两个儿子很特别,就是跟其他的人不太一样,魔一般的执着。兄弟俩都到了要结婚的年龄了,不管自家老爹怎么磨破嘴皮子,兄弟俩说不娶就不娶,老父母为兄弟两操碎了心...

如何磨出破洞牛仔裤?牛仔裤怎么剪破洞?

把牛仔裤磨出有线的破洞 1、具体工具就是磨脚石,下面垫一个硬物,然后用磨脚石一直磨一直磨,到把那块磨薄了,用手撕开就好了。出来的洞啊很自然的。需要猫须的话调几...

我就是扫描下图得到了敬业福和爱国福

先来看下敬业福和爱国福 今年春节,支付宝再次推出了“五福红包”活动,表示要“把欠大家的敬业福都还给大家”。 今天该活动正式启动,和去年一样,需要收集“五福”...

冰箱异味产生的原因和臭味去除的方法

有时候我们打开冰箱就会闻到一股异味,冰箱里的这种异味是因为一些物质发出的气味的混合体,闻起来让人恶心。 产生这些异味的主要原因有以下几点。 1、很多人有这种习...

 
 
yi . jian jie xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci : class A { public: virtual void foo() { cout << "A::foo() is called" << endl;} }; class B: public A { public: virtual void foo() { cout << "B::foo() is called" << endl;} }; na me , zai shi yong de shi hou , wo men ke yi : A * a = new B(); a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de ! zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。 xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de : class A { public: virtual void foo(); }; class B: public A { virtual void foo(); }; void bar() { A a; a.foo(); // A::foo() bei tiao yong } 1.1 duo tai zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie : void bar(A * a) { a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()? } yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。 zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。 1.2 duo tai you shen me yong ? duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。 zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。 duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。 1.3 ru he “ dong tai lian bian ” bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。 wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi : void bar(A * a) { a->foo(); } hui bei gai xie wei : void bar(A * a) { (a->vptr[1])(); } yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。 sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。 1.4 overload he override xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia : override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。 overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 yi . jian jie xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci : class A { public: virtual void foo() { cout << "A::foo() is called" << endl;} }; class B: public A { public: virtual void foo() { cout << "B::foo() is called" << endl;} }; na me , zai shi yong de shi hou , wo men ke yi : A * a = new B(); a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de ! zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。 xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de : class A { public: virtual void foo(); }; class B: public A { virtual void foo(); }; void bar() { A a; a.foo(); // A::foo() bei tiao yong } 1.1 duo tai zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie : void bar(A * a) { a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()? } yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。 zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。 1.2 duo tai you shen me yong ? duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。 zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。 duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。 1.3 ru he “ dong tai lian bian ” bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。 wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi : void bar(A * a) { a->foo(); } hui bei gai xie wei : void bar(A * a) { (a->vptr[1])(); } yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。 sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。 1.4 overload he override xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia : override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。 overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.Html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan yi . jian jie xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci : class A { public: virtual void foo() { cout << "A::foo() is called" << endl;} }; class B: public A { public: virtual void foo() { cout << "B::foo() is called" << endl;} }; na me , zai shi yong de shi hou , wo men ke yi : A * a = new B(); a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de ! zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。 xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de : class A { public: virtual void foo(); }; class B: public A { virtual void foo(); }; void bar() { A a; a.foo(); // A::foo() bei tiao yong } 1.1 duo tai zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie : void bar(A * a) { a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()? } yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。 zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。 1.2 duo tai you shen me yong ? duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。 zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。 duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。 1.3 ru he “ dong tai lian bian ” bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。 wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi : void bar(A * a) { a->foo(); } hui bei gai xie wei : void bar(A * a) { (a->vptr[1])(); } yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。 sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。 1.4 overload he override xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia : override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。 overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan yi . jian jie xu han shu shi C++ zhong yong yu shi xian duo tai (polymorphism) de ji zhi 。 gai xin li nian jiu shi tong guo ji lei fang wen pai sheng lei ding yi de han shu 。 jia she wo men you xia mian de lei ceng ci : class A { public: virtual void foo() { cout << "A::foo() is called" << endl;} }; class B: public A { public: virtual void foo() { cout << "B::foo() is called" << endl;} }; na me , zai shi yong de shi hou , wo men ke yi : A * a = new B(); a->foo(); // zai zhe li ,a sui ran shi zhi xiang A de zhi zhen , dan shi bei tiao yong de han shu (foo) que shi B de ! zhe ge li zi shi xu han shu de yi ge dian xing ying yong , tong guo zhe ge li zi , ye xu ni jiu dui xu han shu you le yi xie gai nian 。 ta xu jiu xu zai suo wei “ tui chi lian bian ” huo zhe “ dong tai lian bian ” shang , yi ge lei han shu de tiao yong bing bu shi zai bian yi shi ke bei que ding de , er shi zai yun xing shi ke bei que ding de 。 you yu bian xie dai ma de shi hou bing bu neng que ding bei tiao yong de shi ji lei de han shu huan shi na ge pai sheng lei de han shu , suo yi bei cheng wei “ xu ” han shu 。 xu han shu zhi neng jie zhu yu zhi zhen huo zhe yin yong lai da dao duo tai de xiao guo , jia ru shi xia mian zhe yang de dai ma , ze sui ran shi xu han shu , dan ta bu shi duo tai de : class A { public: virtual void foo(); }; class B: public A { virtual void foo(); }; void bar() { A a; a.foo(); // A::foo() bei tiao yong } 1.1 duo tai zai le jie le xu han shu de yi si zhi hou , zai kao lv shen me shi duo tai jiu hen qing yi le 。 reng ran zhen dui shang mian de lei ceng ci , dan shi shi yong de fang fa bian de fu duo le yi xie : void bar(A * a) { a->foo(); // bei tiao yong de shi A::foo() huan shi B::foo()? } yin wei foo() shi ge xu han shu , suo yi zai bar zhe ge han shu zhong , zhi gen ju zhe duan dai ma , wu cong que ding zhe li bei tiao yong de shi A::foo() huan shi B::foo(), dan shi ke yi ken ding de shuo : jia ru a zhi xiang de shi A lei de shi li , ze A::foo() bei tiao yong , jia ru a zhi xiang de shi B lei de shi li , ze B::foo() bei tiao yong 。 zhe zhong tong yi dai ma ke yi chan sheng bu tong xiao guo de te dian , bei cheng wei “ duo tai ”。 1.2 duo tai you shen me yong ? duo tai zhe me shen qi , dan shi neng yong lai zuo shen me ne ? zhe ge ming ti wo nan yi yong yi liang ju hua gai kuo , yi ban de C++ jiao cheng ( huo zhe qi ta mian xiang dui xiang yu yan de jiao cheng ) dou yong yi ge hua tu de li zi lai zhan shi duo tai de yong tu , wo jiu bu zai chong fu zhe ge li zi le , jia ru ni bu zhi dao zhe ge li zi , sui bian zhao ben shu ying gai dou you jie shao 。 wo shi tu cong yi ge chou xiang de jiao du miao shu yi xia , hui tou zai jie he na ge hua tu de li zi , ye xu ni jiu geng qing yi li jie 。 zai mian xiang dui xiang de bian cheng zhong , shou xian hui zhen dui shu ju jin xing chou xiang ( que ding ji lei ) he ji xu ( que ding pai sheng lei ), gou cheng lei ceng ci 。 zhe ge lei ceng ci de shi yong zhe zai shi yong ta men de shi hou , jia ru reng ran zai xu yao ji lei de shi hou xie zhen dui ji lei de dai ma , zai xu yao pai sheng lei de shi hou xie zhen dui pai sheng lei de dai ma , jiu deng yu lei ceng ci wan quan bao lu zai shi yong zhe mian qian 。 jia ru zhe ge lei ceng ci you ren he de gai bian ( zeng jia le xin lei ), dou xu yao shi yong zhe “ zhi dao ”( zhen dui xin lei xie dai ma )。 zhe yang jiu zeng jia le lei ceng ci yu qi shi yong zhe zhi jian de ou he , you ren ba zhe zhong qing kuang lie wei cheng xu zhong de “bad smell” zhi yi 。 duo tai ke yi shi cheng xu yuan tuo li zhe zhong jiong jing 。 zai hui tou kan kan 1.1 zhong de li zi ,bar() zuo wei A-B zhe ge lei ceng ci de shi yong zhe , ta bing bu zhi dao zhe ge lei ceng ci zhong you duo shao ge lei , mei ge lei dou jiao shen me , dan shi yi yang ke yi hen hao de gong zuo , dang you yi ge C lei cong A lei pai sheng chu lai hou ,bar() ye bu xu yao “ zhi dao ”( xiu gai )。 zhe wan quan gui gong yu duo tai -- bian yi qi zhen dui xu han shu chan sheng le ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma 。 1.3 ru he “ dong tai lian bian ” bian yi qi shi ru he zhen dui xu han shu chan sheng ke yi zai yun xing shi ke que ding bei tiao yong han shu de dai ma ne ? ye jiu shi shuo , xu han shu shi ji shang shi ru he bei bian yi qi chu li de ne ?Lippman zai shen du tan suo C++ dui xiang mo xing [1] zhong de bu tong zhang jie jiang dao le ji zhong fang shi , zhe li ba “ biao zhun de ” fang shi jian dan jie shao yi xia 。 wo suo shuo de “ biao zhun ” fang shi , ye jiu shi suo wei de “VTABLE” ji zhi 。 bian yi qi fa xian yi ge lei zhong you bei sheng ming wei virtual de han shu , jiu hui wei qi gao yi ge xu han shu biao , ye jiu shi VTABLE。VTABLE shi ji shang shi yi ge han shu zhi zhen de shu zu , mei ge xu han shu zhan yong zhe ge shu zu de yi ge slot。 yi ge lei zhi you yi ge VTABLE, bu guan ta you duo shao ge shi li 。 pai sheng lei you zi ji de VTABLE, dan shi pai sheng lei de VTABLE yu ji lei de VTABLE you xiang tong de han shu pai lie shun xu , tong ming de xu han shu bei fang zai liang ge shu zu de xiang tong wei zhi shang 。 zai chuang jian lei shi li de shi hou , bian yi qi huan hui zai mei ge shi li de nei cun bu ju zhong zeng jia yi ge vptr zi duan , gai zi duan zhi xiang ben lei de VTABLE。 tong guo zhe xie shou duan , bian yi qi zai kan dao yi ge xu han shu tiao yong de shi hou , jiu hui jiang zhe ge tiao yong gai xie , zhen dui 1.1 zhong de li zi : void bar(A * a) { a->foo(); } hui bei gai xie wei : void bar(A * a) { (a->vptr[1])(); } yin wei pai sheng lei he ji lei de foo() han shu ju you xiang tong de VTABLE suo yin , er ta men de vptr you zhi xiang bu tong de VTABLE, yin ci tong guo zhe yang de fang fa ke yi zai yun xing shi ke jue ding tiao yong na ge foo() han shu 。 sui ran shi ji qing kuang yuan fei zhe me jian dan , dan shi ji ben yuan li da zhi ru ci 。 1.4 overload he override xu han shu zong shi zai pai sheng lei zhong bei gai xie , zhe zhong gai xie bei cheng wei “override”。 wo jing chang hun xiao “overload” he “override” zhe liang ge dan ci 。 dan shi sui zhe ge lei C++ de shu yue lai yue duo , hou lai de cheng xu yuan ye xu bu hui zai fan wo fan guo de cuo wu le 。 dan shi wo da suan cheng qing yi xia : override shi zhi pai sheng lei chong xie ji lei de xu han shu , jiu xiang wo men qian mian B lei zhong chong xie le A lei zhong de foo() han shu 。 chong xie de han shu bi xu you yi zhi de shen shu biao he fan hui zhi (C++ biao zhun da ying fan hui zhi bu tong de qing kuang , zhe ge wo hui zai “ yu fa ” bu fen jian dan jie shao , dan shi hen shao bian yi qi zhi chi zhe ge feature)。 zhe ge dan ci hao xiang yi zhi mei you shen me he shi de zhong wen ci hui lai dui ying , you ren yi wei “ fu gai ”, huan tie qie yi xie 。 overload yue ding cheng su de bei fan yi wei “ chong zai ”。 shi zhi bian xie yi ge yu yi you han shu tong ming dan shi shen shu biao bu tong de han shu 。 li ru yi ge han shu ji ke yi jie shou zheng xing shu zuo wei shen shu , ye ke yi jie shou fu dian shu zuo wei shen shu 。 QQread.com tui chu you xi gong lue http://www.qqread.com/netgame/game/index.html mo shou shi jie pao pao ka ding che jie tou lan qiu shui hu Q chuan long yu di xia cheng OL zheng fu xuan yuan jian 5 FIFA07 re xue jiang hu da tang feng yun meng huan xi you wu lin wai chuan right"( chu chu : qing feng ruan jian xia zai xue yuan )
󰈣󰈤
  免责声明:本文仅代表作者个人观点,与王朝网络无关。王朝网络登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
赏心悦目的模特儿(9)
赏心悦目的模特儿(8)
赏心悦目的模特儿(7)
赏心悦目的模特儿(6)
周六一日游--绿野翠蜂场(一)
骆驼峰
下一站上环
杂乱的几张Danang
 
>>返回首页<<
 
 
 为你推荐
 
 
 
 转载本文
 UBB代码 HTML代码
复制到剪贴板...
 
 热帖排行
 
 
 
 
 
©2005- 王朝网络 版权所有