{"id":2016,"date":"2011-02-11T00:10:54","date_gmt":"2011-02-10T15:10:54","guid":{"rendered":"http:\/\/www.moonmile.net\/blog\/archives\/2016"},"modified":"2011-02-11T00:42:20","modified_gmt":"2011-02-10T15:42:20","slug":"%e3%82%a2%e3%83%aa%e3%82%b9%e3%81%af%e3%83%ad%e3%83%aa%e3%83%bc%e3%82%bf%e3%81%a8%e9%9e%84%e3%82%92%e5%85%b1%e6%9c%89%e3%81%97%e3%81%aa%e3%81%84","status":"publish","type":"post","link":"http:\/\/www.moonmile.net\/blog\/archives\/2016","title":{"rendered":"\u30a2\u30ea\u30b9\u306f\u30ed\u30ea\u30fc\u30bf\u3068\u9784\u3092\u5171\u6709\u3057\u306a\u3044"},"content":{"rendered":"<p>\n\u5f15\u304d\u7d9a\u304d\u3001\u30a2\u30ea\u30d7\u30e9\u30b7\u30ea\u30fc\u30ba\u3002\n<\/p>\n<p>\n\u30eb\u30a4\u30b9\u304c\u9784\u3092\u30d7\u30ec\u30bc\u30f3\u30c8\u3059\u308b\u76f8\u624b\u306f\u3001\u30a2\u30ea\u30b9\u3060\u3063\u305f\u308a\u30ed\u30ea\u30fc\u30bf\u3060\u3063\u305f\u308a\u3059\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u9593\u9055\u3063\u3066\u30ed\u30ea\u30fc\u30bf\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\u3057\u305f\u3082\u306e\u3092\u30a2\u30ea\u30b9\u306b\u6e21\u3057\u305f\u3068\u304d\u306e\u53cd\u5fdc\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\uff1f\u3063\u3066\u306a\u8a2d\u5b9a\u304c\u6b21\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\n\/\/ for \u30a2\u30ea\u30b9\u306f\u30ed\u30ea\u30fc\u30bf\u3068\u9784\u3092\u5171\u6709\u3057\u306a\u3044\n\n#include &lt;iostream&gt;\n#include &lt;list&gt;\nusing namespace std;\n\nclass Bag {\nprotected:\n\tvoid *_mark;\npublic:\n\tBag() : _mark(NULL) {}\n\tvirtual void setMark( void *mark ) {\n\t\t_mark = mark;\n\t}\n\tvirtual void *getMark() {\n\t\treturn _mark;\n\t}\n};\n\nclass Prada : public Bag {};\nclass Tiffany : public Bag {};\n\nclass Alice\n{\nprivate:\n\tlist&lt;Bag*&gt; bags;\npublic:\n\tAlice() {\n\t}\n\tvoid Present( Bag *bag ) \n\t{\n\t\tif ( dynamic_cast&lt;Prada*&gt;(bag) != NULL &amp;&amp;\n             bag-&gt;getMark() == NULL ) \n\t\t{\n\t\t\tbag-&gt;setMark( this );\n\t\t\tbags.push_back( bag );\n\t\t}\n\t}\n\tint CountBags() \n\t{\n\t\treturn bags.size();\n\t}\n};\n\nclass Lolita \n{\nprivate:\n\tlist&lt;Bag*&gt; bags;\npublic:\n\tvoid Present( Bag *bag ) \n\t{\n\t\tbag-&gt;setMark( this );\n\t\tbags.push_back( bag );\n\t}\n};\n\nint main(void)\n{\n\tAlice alice;\n\tLolita lolita;\n\t\n\tcout &lt;&lt; &amp;quot;alice has &amp;quot; &lt;&lt; alice.CountBags() &lt;&lt; &amp;quot; bags.&amp;quot; &lt;&lt; endl;\n\talice.Present(new Prada());\n\tcout &lt;&lt; &amp;quot;alice has &amp;quot; &lt;&lt; alice.CountBags() &lt;&lt; &amp;quot; bags.&amp;quot; &lt;&lt; endl;\n\talice.Present(new Tiffany());\n\tcout &lt;&lt; &amp;quot;alice has &amp;quot; &lt;&lt; alice.CountBags() &lt;&lt; &amp;quot; bags.&amp;quot; &lt;&lt; endl;\n\t\/\/ \u4e00\u5ea6\u30ed\u30ea\u30fc\u30bf\u306b\u3042\u3052\u308b\n\tBag *bag = new Prada();\n\tlolita.Present( bag );\n\t\/\/ \u305d\u3057\u3066\u30a2\u30ea\u30b9\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\n\talice.Present(bag); \n\tcout &lt;&lt; &amp;quot;alice has &amp;quot; &lt;&lt; alice.CountBags() &lt;&lt; &amp;quot; bags.&amp;quot; &lt;&lt; endl;\n\tbag = new Prada();\n\talice.Present(bag);\n\tcout &lt;&lt; &amp;quot;alice has &amp;quot; &lt;&lt; alice.CountBags() &lt;&lt; &amp;quot; bags.&amp;quot; &lt;&lt; endl;\n\n\t\/\/ \u5b9f\u306f\u3001\u30a2\u30ea\u30b9\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\u3057\u305f\u3082\u306e\u3092\u30ed\u30ea\u30fc\u30bf\u306b\u3042\u3052\u308b\u3053\u3068\u3082\u3067\u304d\u308b\n\tlolita.Present( bag );\n\n\treturn 0;\n}\n<\/pre>\n<p>\n\u30d0\u30c3\u30b0\u81ea\u4f53\u306b\u30de\u30fc\u30ad\u30f3\u30b0\u3092\u4ed8\u3051\u3066\u3044\u308b\u306e\u3067\u3001\u81ea\u5206\u306e\u9784\u304b\u3069\u3046\u304b\u306f\u5206\u304b\u308b\u306e\u3067\u3001\u4e00\u5ea6\u30ed\u30ea\u30fc\u30bf\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\u3055\u308c\u305f\u9784\u3092\u62d2\u5426\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\n<\/p>\n<p>\n\u304c\u3001\u554f\u984c\u306f\u3001\u30a2\u30ea\u30b9\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\u3057\u305f\u9784\u306f\u30ed\u30ea\u30fc\u30bf\u306b\u3088\u3063\u3066\u30de\u30fc\u30ad\u30f3\u30b0\u304c\u4e0a\u66f8\u304d\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3001\u305d\u306e\u9784\u306f\u30ed\u30ea\u30fc\u30bf\u306e\u3082\u306e\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3093\u3067\u3059\u306d\u3047\u3002\u56f0\u3063\u305f\u3002\n<\/p>\n<p>\n\u3053\u308c\u3092\u9632\u3050\u306b\u306f\u3001Bag \u30af\u30e9\u30b9\u306e mark \u306e\u51e6\u3092\u6b21\u306e\u3088\u3046\u306b1\u56de\u3060\u3051\u66f8\u304f\u3088\u3046\u306b\u76f4\u3057\u307e\u3059\u3002\n<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nclass Bag {\nprotected:\n\tvoid *_mark;\npublic:\n\tBag() : _mark(NULL) {}\n\tvirtual void setMark( void *mark ) {\n\t\tif ( _mark == NULL ) {\n\t\t\t_mark = mark;\n\t\t}\n\t}\n\tvirtual void *getMark() {\n\t\treturn _mark;\n\t}\n};\n<\/pre>\n<p>\n\u3048\u3048\u3001\u4f55\u51e6\u304b\u3067\u307f\u305f\u3088\u3046\u306a\u30b3\u30d4\u30fc\u30ef\u30f3\u30b9\u306e\u51e6\u7406\u3067\u3059\u306d\u3002\u4f3c\u305f\u3088\u3046\u306a\u611f\u3058\u3067 Use \u30e1\u30bd\u30c3\u30c9\u306e\u4e2d\u3067\u30ab\u30a6\u30f3\u30bf\u3092\u6e1b\u3089\u305b\u3070\u3001\u30e6\u30fc\u30ba\u30ef\u30f3\u30b9\u3001\u306e\u51e6\u7406\u3082\u53ef\u80fd\u3067\u3059\u3002\u305f\u3060\u3057\u3001\u30b3\u30d4\u30fc\u30ef\u30f3\u30b9\u306e\u6a5f\u80fd\u3082\u3001\u30b3\u30d4\u30fc\u5bfe\u8c61\uff08Prada \u3068\u304b DVD \u3068\u304b)\u3092\u6271\u3046\u30e2\u30ce(Lolita \u3068\u304b\u30d3\u30c7\u30aa\u6a5f\u5668\u3068\u304b)\u304c Used \u3092\u304d\u3061\u3093\u3068\u547c\u3073\u51fa\u3055\u306a\u3051\u308c\u3070\u3001\u5229\u7528\u306f\u53ef\u80fd\u306a\u306e\u3067\u3059\u3002<br \/>\n\u3053\u306e\u3042\u305f\u308a\u306e\u30b3\u30d4\u30fc\u30ef\u30f3\u30b9\u306e\u30ac\u30fc\u30c9\u3092\u78ba\u5b9f\u306b\u547c\u3073\u51fa\u3055\u305b\u308b\u305f\u3081\u306b\u306f\u3001\u4f8b\u3048\u3070<b>\u521d\u671f\u306e\u6697\u53f7\u89e3\u8aad\u306e\u305f\u3081\u306e\u30ad\u30fc<\/b>\u306e\u8aad\u307f\u51fa\u3057\u81ea\u4f53\u306b\u30b3\u30d4\u30fc\u30ef\u30f3\u30b9\u306e\u30ac\u30fc\u30c9\u3092\u5165\u308c\u308b\u3068\u304b\u3001\u5229\u7528\u306b\u5fc5\u9808\u306a\u3082\u306e\u306b\u5bfe\u3057\u3066\u30ac\u30fc\u30c9\u3092\u5165\u308c\u8fbc\u307f\u307e\u3059\u3002\u5b9f\u306f\u4f3c\u305f\u3088\u3046\u3068\u3053\u308d\u3067\u306f\u3001SNS \u306e\u30ed\u30b0\u30a4\u30f3\u6a5f\u80fd\u3068\u304b\u3001\u30b2\u30fc\u30e0\u30bd\u30d5\u30c8\u306e\u30b3\u30d4\u30fc\u30ac\u30fc\u30c9\u306e\u4ed5\u65b9\u3068\u304b\u3082\u4f3c\u305f\u65b9\u5f0f\u3067\u3059\u3002\u6700\u521d\u306b\u30ac\u30fc\u30c9\u3092\u7f6e\u304d\u307e\u3059\u3002<br \/>\n\u306a\u306e\u3067\u3001\u5b9f\u306f\u6700\u521d\u306b\u30ac\u30fc\u30c9\u3092\u7f6e\u304b\u305a\u306b\u3001\u672c\u4f53\u306e\u6240\u3005\u306b\u30ac\u30fc\u30c9\u3092\u5206\u6563\u3055\u305b\u308b\u3063\u3066\u306e\u3082\u30a2\u30ea\u306a\u3093\u3067\u3059\u3088\u306d\u3002\u78ba\u304b\u3001\u8ca9\u58f2 DVD \u306e\u30b3\u30d4\u30fc\u30ac\u30fc\u30c9\u306f\u3053\u306e\u65b9\u5f0f\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f15\u304d\u7d9a\u304d\u3001\u30a2\u30ea\u30d7\u30e9\u30b7\u30ea\u30fc\u30ba\u3002 \u30eb\u30a4\u30b9\u304c\u9784\u3092\u30d7\u30ec\u30bc\u30f3\u30c8\u3059\u308b\u76f8\u624b\u306f\u3001\u30a2\u30ea\u30b9\u3060\u3063\u305f\u308a\u30ed\u30ea\u30fc\u30bf\u3060\u3063\u305f\u308a\u3059\u308b\u308f\u3051\u3067\u3059\u304c\u3001\u9593\u9055\u3063\u3066\u30ed\u30ea\u30fc\u30bf\u306b\u30d7\u30ec\u30bc\u30f3\u30c8\u3057\u305f\u3082\u306e\u3092\u30a2\u30ea\u30b9\u306b\u6e21\u3057\u305f\u3068\u304d\u306e\u53cd\u5fdc\u306f\u3069\u3046\u3067\u3057\u3087\u3046\u304b\uff1f\u3063\u3066\u306a\u8a2d\u5b9a\u304c\u6b21\u306e\u30b3\u30fc\u30c9\u3067\u3059\u3002  &hellip; <a href=\"http:\/\/www.moonmile.net\/blog\/archives\/2016\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[22],"tags":[],"class_list":["post-2016","post","type-post","status-publish","format-standard","hentry","category-c"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/comments?post=2016"}],"version-history":[{"count":1,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2016\/revisions"}],"predecessor-version":[{"id":2021,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/posts\/2016\/revisions\/2021"}],"wp:attachment":[{"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/media?parent=2016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/categories?post=2016"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.moonmile.net\/blog\/wp-json\/wp\/v2\/tags?post=2016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}