-
说明
-
案例
-
书接上回
- 鞋贩子的卖鞋在当地有了名气,需要出席一些会议。
- 自己懒散惯了,穿着随意,也没有穿过正装,而参加会议的着装有要求。
- 必须西装革履加皮鞋。
-
案例
#include<iostream> #include<string> class HuiYiBiaoZhun { public: virtual std::string XingMing() = 0; virtual std::string XiZhuang() = 0 ; virtual std::string PiXie() = 0; }; void HuiYiRuChange(HuiYiBiaoZhun* can_hui_ren) { std::cout << "name:" << can_hui_ren->XingMing() << "," << "wear:" << can_hui_ren->XiZhuang() << "," << "shoes:" << can_hui_ren->PiXie() << "," << std::endl; } class XieFanZi { public: XieFanZi() { name_ = "fa wai kuang tu -- zhang san"; } std::string getName() { return name_; } private: std::string name_; }; class XieFanZiDeXiZhuang : public HuiYiBiaoZhun { public: XieFanZiDeXiZhuang(XieFanZi* xiefanzi):xiefanzi_(xiefanzi) { } std::string XingMing() { return xiefanzi_->getName(); } std::string XiZhuang() { return "xin xi zhuang"; } std::string PiXie() { return "xin pi xie"; } private: XieFanZi* xiefanzi_; }; int main() { XieFanZi xiefanzi; HuiYiBiaoZhun* xiefanzi_xi_zhuang_mo_shi = new XieFanZiDeXiZhuang(&xiefanzi); HuiYiRuChange(xiefanzi_xi_zhuang_mo_shi); }
- 鞋贩子切换成西装模式
(换了西装)
就可以参加会议了。 - 即变装秀。
- 鞋贩子切换成西装模式
-
-
总结
03-09
2万+
09-09
1742
06-04
1268
03-14
7658