{"rsdb":{"rid":"156015","subhead":"","postdate":"0","aid":"117121","fid":"49","uid":"1","topic":"1","content":"
\n

C++<\/a>\u5916\u89c2\u6a21\u5f0f\uff1a<\/strong>\u5728\u8bb2\u89e3\u6a21\u5f0f\u4e4b\u524d\uff0c\u5148\u6765\u4e3e\u4e2a\u751f\u6d3b\u4e2d\u7684\u4f8b\u5b50\u5427\uff1a\u4e3a\u4e86\u65b9\u4fbf\uff0c\u4e00\u4e2a\u7535\u6e90\u603b\u5f00\u5173\u63a7\u5236\u56db\u76cf\u706f\uff0c\u4e00\u4e2a\u98ce\u6247\uff0c\u4e00\u53f0\u7a7a\u8c03\u548c\u4e00\u53f0\u7535\u89c6\u673a\u7684\u542f\u52a8\u4e0e\u5173\u95ed\u3002\u5047\u8bbe\u6ca1\u6709\u8fd9\u4e2a\u603b\u5f00\u5173\uff0c\u53ef\u60f3\u800c\u77e5\uff0c\u542f\u52a8\u4e00\u6b21\u6216\u8005\u5173\u95ed\u4e00\u6b21\u8fd9\u4e9b\u8bbe\u5907\uff0c\u9700\u8981\u91cd\u590d\u591a\u6b21\u76f8\u540c\u7684\u5de5\u4f5c\u3002\u9002\u5f53\u5f15\u5165\u7535\u6e90\u603b\u5f00\u5173\u540c\u65f6\u63a7\u5236\u6240\u6709\u8bbe\u5907\uff0c\u6781\u5927\u7684\u63d0\u9ad8\u4e86\u6548\u7387\uff0c\u8fd9\u5c31\u662f\u5916\u89c2\u6a21\u5f0f\u7684\u7f29\u5f71\u3002\u8fd9\u7bc7\u535a\u5ba2\u5177\u4f53\u8bb2\u89e3\u4e86\u5916\u89c2\u6a21\u5f0f\uff0c\u5bf9\u6a21\u5f0f\u52a8\u673a\uff0c\u4f7f\u7528\u573a\u666f\uff0c\u4f18\u7f3a\u70b9\uff0cUML\u7c7b\u56fe\u7b49\u8fdb\u884c\u4e86\u5206\u6790\uff0c\u4ee5\u53caC++<\/a>\u4ee3\u7801\u5b9e\u73b0\u3002

\u5916\u89c2\u6a21\u5f0f\uff08
Facade<\/a>\uff09\u662f\u6307\u5916\u90e8\u4e0e\u5b50\u7cfb\u7edf<\/a>\u7684\u901a\u4fe1\u5fc5\u987b\u901a\u8fc7\u4e00\u4e2a\u7edf\u4e00\u7684\u5916\u89c2\u5bf9\u8c61\u8fdb\u884c\uff0c\u4e3a\u5b50\u7cfb\u7edf\u4e2d\u7684\u4e00\u7ec4\u63a5\u53e3\u63d0\u4f9b\u4e00\u4e2a\u4e00\u81f4\u7684\u754c\u9762\uff0c\u5b9a\u4e49\u4e00\u4e2a\u9ad8\u5c42\u63a5\u53e3\uff0c\u8fd9\u4e2a\u63a5\u53e3\u4f7f\u5f97\u8fd9\u4e00\u5b50\u7cfb\u7edf\u66f4\u52a0\u5bb9\u6613\u4f7f\u7528\u3002\u5916\u89c2\u6a21\u5f0f\u53c8\u79f0\u4e3a\u95e8\u9762\u6a21\u5f0f\uff0c\u5b83\u662f\u4e00\u79cd\u5bf9\u8c61\u7ed3\u6784\u578b\u6a21\u5f0f\uff0c\u5b8c\u7f8e\u7684\u4f53\u73b0\u4e86\u8fea\u7c73\u7279\u6cd5\u5219\uff0c\u5f15\u5165\u5916\u89c2\u6a21\u5f0f\u540e\uff0c\u7528\u6237\u53ea\u9700\u76f4\u63a5\u4e0e\u5916\u89c2\u89d2\u8272\u4ea4\u4e92\uff0c\u7528\u6237\u4e0e\u5b50\u7cfb\u7edf\u4e4b\u95f4\u7684\u590d\u6742\u5173\u7cfb\u7531\u5916\u89c2\u89d2\u8272\u6765\u5b9e\u73b0\uff0c\u4ece\u800c\u964d\u4f4e\u4e86\u7cfb\u7edf\u7684\u8026\u5408\u5ea6\u3002\u63d0\u9ad8\u4e86\u5ba2\u6237\u7aef\u4f7f\u7528\u7684\u4fbf\u6377\u6027\uff0c\u4f7f\u5f97\u5ba2\u6237\u7aef\u65e0\u987b\u5173\u7cfb\u5b50\u7cfb\u7edf\u7684\u5de5\u4f5c\u7ec6\u8282\uff0c\u901a\u8fc7\u5916\u89c2\u5373\u53ef\u8c03\u7528\u76f8\u5173\u529f\u80fd\u3002\u4e0b\u9762\u6211\u4eec\u4ee5\u4e00\u4e2a\u7cfb\u7edf\u9700\u6c42\u5165\u624b\u6765\u8fdb\u884c\u5206\u6790\uff1a<\/p> \n

\u67d0\u8f6f\u4ef6\u516c\u53f8\u4e3a\u65b0\u5f00\u53d1\u7684\u667a\u80fd\u624b\u673a\u63a7\u5236\u4e0e\u7ba1\u7406\u8f6f\u4ef6\u63d0\u4f9b\u4e86\u4e00\u952e\u5907\u4efd\u529f\u80fd\uff0c\u901a\u8fc7\u8be5\u529f\u80fd\u53ef\u4ee5\u5c06\u539f\u672c\u5b58\u50a8\u5728\u624b\u673a\u4e2d\u7684\u901a\u4fe1\u5f55\u3001\u77ed\u4fe1\u3001\u7167\u7247\u3001\u6b4c\u66f2\u7b49\u8d44\u6599\u4e00\u6b21\u6027\u5168\u90e8\u62f7\u8d1d\u5230\u79fb\u52a8\u5b58\u50a8\u4ecb\u8d28\uff08\u4f8b\u5982MMC\u5361\u6216SD\u5361\uff09\u4e2d\u3002\u5728\u5b9e\u73b0\u8fc7\u7a0b\u4e2d\u9700\u8981\u4e0e\u591a\u4e2a\u5df2\u6709\u7684\u7c7b\u8fdb\u884c\u4ea4\u4e92\uff0c\u4f8b\u5982\u901a\u8baf\u5f55\u7ba1\u7406\u7c7b\u3001\u77ed\u4fe1\u7ba1\u7406\u7c7b\u7b49\uff0c\u4e3a\u4e86\u964d\u4f4e\u7cfb\u7edf\u7684\u8026\u5408\u5ea6\uff0c\u8bd5\u4f7f\u7528\u5408\u9002\u7684\u8bbe\u8ba1\u6a21\u5f0f\u6765\u8bbe\u8ba1\u5e76\u7f16\u7a0b<\/a><\/a>\u6a21\u62df\u5b9e\u73b0\u8be5\u4e00\u952e\u5907\u4efd\u529f\u80fd\u3002<\/p> \n

\u5728\u8fd9\u4e2a\u9700\u6c42\u9898\u76ee\u4e2d\uff0c\u540c\u65f6\u5c06\u8d44\u6599\u62f7\u8d1d\u5230\u4e0d\u540c\u7684\u5b58\u50a8\u8bbe\u5907\u4e2d\uff0c\u8fd9\u91cc\u6211\u4eec\u5c31\u5b9a\u4e49\u4e09\u79cd\u5907\u4efd\u8d44\u6599\uff08\u77ed\u4fe1\uff0c\u7167\u7247\uff0c\u6b4c\u66f2\uff09\u6765\u8fdb\u884c\u8bbe\u8ba1\uff0c\u4e0b\u9762\u662fUML\u7c7b\u56fe\uff1a<\/p> \n

\"\\\"<\/p> \n

\"UML\u7c7b\u56fe\"<\/p> \n

\u5176\u4e2d\uff0c\u5916\u89c2\u7c7b\u4e0e\u4e09\u4e2a\u5177\u4f53\u7684\u5907\u4efd\u7c7b\u662f\u7ec4\u5408\u5173\u7cfb\uff0c\u5177\u6709\u4e00\u5b9aUML\u57fa\u7840\u7684\u670b\u53cb\u4eec\u4e00\u773c\u5c31\u53ef\u770b\u61c2\u539f\u7406\uff0c\u878d\u5165\u5230\u81ea\u5df1\u7a0b\u5e8f\u8bbe\u8ba1\u4e2d\u3002<\/p> \n

\u4e0b\u9762\u662fC++\u4ee3\u7801\u7684\u5b9e\u73b0\uff1a<\/p> \n

<\/p> \n

\r\nCopyMessage.h:\r\n#pragma \r\n#include\n  \n   \r\nusing namespace std;\r\nclass CopyMessage\r\n{\r\npublic:\r\n\tCopyMessage();\r\n\t~CopyMessage();\r\n\tvoid copy();\r\n};\r\n\r\nCopyMessage.cpp:\r\n#include \"CopyMessage.h\"\r\n\r\n\r\n\r\nCopyMessage::CopyMessage()\r\n{\r\n}\r\n\r\n\r\nCopyMessage::~CopyMessage()\r\n{\r\n}\r\n\r\nvoid CopyMessage::copy() {\r\n\tcout << \"\u77ed\u4fe1\u5df2\u5907\u4efd\uff1b\" << endl;\r\n}\r\n\r\nCopyMusic.h:\r\n#pragma once\r\n#include\n   \n     using namespace std; class CopyMusic { public: CopyMusic(); ~CopyMusic(); void copy(); }; CopyMusic.cpp: #include \"CopyMusic.h\" CopyMusic::CopyMusic() { } CopyMusic::~CopyMusic() { } void CopyMusic::copy() { cout << \"\u97f3\u4e50\u5df2\u5907\u4efd\uff1b\" << endl; } CopyPicture.h: #pragma once #include\n    \n      using namespace std; class CopyPicture { public: CopyPicture(); ~CopyPicture(); void copy(); }; CopyPicture.cpp: #include \"CopyPicture.h\" CopyPicture::CopyPicture() { } CopyPicture::~CopyPicture() { } void CopyPicture::copy() { cout << \"\u7167\u7247\u5df2\u5907\u4efd\uff1b\" << endl; } Facade.h: #pragma once #include \"CopyMessage.h\" #include \"CopyMusic.h\" #include \"CopyPicture.h\" class Facade { private: CopyMessage msg; CopyMusic music; CopyPicture picture; public: Facade(); ~Facade(); void copy(); }; Facade.cpp: #include \"Facade.h\" Facade::Facade() { } Facade::~Facade() { } void Facade::copy() { msg.copy(); picture.copy(); music.copy(); } main.cpp: #include\n     \n       #include \"Facade.h\" using namespace std; int main() { Facade facade; facade.copy(); system(\"pause\"); }\n     <\/iostream>\n    <\/iostream>\n   <\/iostream>\n  <\/iostream><\/pre> \n 
\n

\u6700\u540e\u6211\u4eec\u6765\u8bf4\u4e00\u4e0b\u5916\u89c2\u6a21\u5f0f\u7684\u4f18\u7f3a\u70b9\u5427\u3002\u5b83\u7684\u4f18\u70b9\u6709\u5f88\u660e\u663e\uff0c\u5bf9\u5ba2\u6237\u5c4f\u853d\u4e86\u5b50\u7cfb\u7edf\u7ec4\u4ef6<\/a>\uff0c\u5ba2\u6237\u4ee3\u7801\u53d8\u5f97\u7b80\u5355\uff0c\u4e0e\u4e4b\u5173\u8054\u7684\u5bf9\u8c61\u51cf\u5c11\uff1b\u5b50\u7cfb\u7edf\u548c\u5ba2\u6237\u7aef\u4e4b\u95f4\u677e\u8026\u5408\uff0c\u5b50\u7cfb\u7edf\u7684\u53d8\u5316\u4e0d\u4f1a\u5f71\u54cd\u5230\u5ba2\u6237\u7aef\u4f7f\u7528\u5b83\uff1b\u964d\u4f4e\u4e86\u5927\u578b\u7cfb\u7edf\u7684\u7f16\u8bd1\u4f9d\u8d56\u6027\u7b49\u7b49\u3002\u7136\u800c\u7f3a\u70b9\u4e5f\u662f\u4e0d\u53ef\u907f\u514d\u7684\uff0c\u5b83\u4e0d\u80fd\u5f88\u597d\u7684\u9650\u5236\u5ba2\u6237\u4f7f\u7528\u5b50\u7cfb\u7edf\uff0c\u5982\u679c\u5bf9\u5b50\u7cfb\u7edf\u9650\u5236\u592a\u591a\u5219\u51cf\u5c11\u4e86\u53ef\u53d8\u6027\u548c\u7075\u6d3b\u6027\uff1b\u5728\u4e0d\u5f15\u5165\u62bd\u8c61\u7c7b\u7684\u60c5\u51b5\u4e0b\uff0c\u589e\u52a0\u5b50\u7cfb\u7edf\u4f1a\u8fdd\u80cc\u5f00\u95ed\u539f\u5219\u7b49\u7b49\u3002<\/p> \n

\u5916\u89c2\u6a21\u5f0f\u786e\u5b9e\u5c5e\u4e8e\u6bd4\u8f83\u7b80\u5355\u7684\u6a21\u5f0f\u4e86\u3002\u4f46\u662f\u5728\u7cfb\u7edf\u5f00\u53d1\u4e2d\u662f\u4f7f\u7528\u9891\u7387\u975e\u5e38\u9ad8\u7684\u6a21\u5f0f\uff0c\u5f88\u6709\u5fc5\u8981\u638c\u63e1\u5b83\uff0c\u5728\u6211\u4eec\u7684\u7a0b\u5e8f\u8bbe\u8ba1\u4e2d\u5408\u7406\u8fd0\u7528\u5b83\uff0c\u5c06\u4f1a\u7ed9\u7a0b\u5e8f\u8bbe\u8ba1\u5e26\u6765\u5f88\u591a\u7684\u597d\u5904\u3002\u5e0c\u671b\u8fd9\u7bc7\u535a\u5ba2\u5bf9\u5927\u5bb6\u5b66\u4e60\u5916\u89c2\u6a21\u5f0f\u6709\u6240\u5e2e\u52a9\uff0c\u82e5\u6709\u7591\u95ee\u7684\uff0c\u53ef\u5411\u6211\u7559\u8a00\uff0c\u6709\u95ee\u5fc5\u7b54\uff01<\/p> \n<\/dd>","orderid":"0","title":"C++\u5916\u89c2\u6a21\u5f0f","smalltitle":"","mid":"0","fname":"c++\u7f16\u7a0b\u57fa\u7840","special_id":"0","bak_id":"0","info":"0","hits":"30","pages":"1","comments":"0","posttime":"2017-01-10 08:14:59","list":"1484007299","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/www.cppentry.com\/upload_files\/","ispic":"0","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"\u5916\u89c2<\/A> \u6a21\u5f0f<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.36","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"C++\u5916\u89c2\u6a21\u5f0f","lastview":"1484903537","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}