{"id":1205,"date":"2010-04-10T16:44:19","date_gmt":"2010-04-10T08:44:19","guid":{"rendered":"http:\/\/www.slyar.com\/blog\/?p=1205"},"modified":"2014-04-22T13:48:39","modified_gmt":"2014-04-22T05:48:39","slug":"cpp-constructors-function","status":"publish","type":"post","link":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html","title":{"rendered":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b"},"content":{"rendered":"<p>\u6587\u7ae0\u4f5c\u8005\uff1a<span style=\"color: #0000ff;\">\u59dc\u5357(Slyar) <\/span>\u6587\u7ae0\u6765\u6e90\uff1aSlyar Home (<a title=\"Slyar\" href=\"http:\/\/www.slyar.com\" target=\"_blank\">www.slyar.com<\/a>) \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff0c\u8c22\u8c22\u5408\u4f5c\u3002<\/p>\n<p>\u5047\u8bbeList\u662f\u4e00\u4e2aC++\u7c7b\u7684\u540d\u5b57\uff0c\u95ee: List x \u548c List x() \u6709\u533a\u522b\u4e48\uff1f<\/p>\n<p>A big difference!<\/p>\n<p>\u51fd\u6570f()\u58f0\u660e\u4e86\u4e00\u4e2a\u540d\u4e3ax\u7684List\u7c7b\u7684\u5b9e\u4f8b<\/p>\n<pre lang=\"c\">\r\nvoid f()\r\n{\r\nList x;     \/\/ Local object named x (of class List)\r\n...\r\n}\r\n<\/pre>\n<p>\u800c\u51fd\u6570g()\u58f0\u660e\u7684\u662f\u4e00\u4e2a\u540d\u4e3ax()\u7684\u51fd\u6570\uff0c\u5b83\u7684\u8fd4\u56de\u503c\u662f\u4e00\u4e2aList<\/p>\n<pre lang=\"c\">\r\nvoid g()\r\n{\r\nList x();   \/\/ Function named x (that returns a List)\r\n...\r\n}\r\n<\/pre>\n<p>\u6ce8\u610f\uff0c\u8fd9\u4e2a\u548c\u6784\u9020\u51fd\u6570\u4e0d\u4e00\u6837(new List &amp; new List())...<\/p>\n<p>\u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff1a<a href=\"http:\/\/www.slyar.com\/blog\">Slyar Home<\/a> &raquo; <a href=\"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html\">C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b<\/a><\/p>","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u4f5c\u8005\uff1a\u59dc\u5357(Slyar) \u6587\u7ae0\u6765\u6e90\uff1aSlyar Home (www.slyar.com) \u8f6c\u8f7d\u8bf7\u6ce8\u660e\uff0c\u8c22\u8c22\u5408\u4f5c\u3002 \u5047\u8bbeList\u662f\u4e00\u4e2aC++\u7c7b\u7684\u540d\u5b57\uff0c\u95ee: List x \u548c List x() \u6709\u533a\u522b\u4e48\uff1f A big difference! \u51fd\u6570f( [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[303,304],"class_list":["post-1205","post","type-post","status-publish","format-standard","hentry","category-programing","tag-303","tag-304"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.2.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Slyar\"\/>\n\t<meta name=\"keywords\" content=\"slyar,c++,class,\u7c7b,\u51fd\u6570,\u8fd4\u56de,\u5b9e\u4f8b,\u5dee\u8ddd\" \/>\n\t<link rel=\"canonical\" href=\"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.2.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"zh_CN\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Slyar Home | \u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home\" \/>\n\t\t<meta property=\"og:description\" content=\"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b\" \/>\n\t\t<meta property=\"og:url\" content=\"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2010-04-10T08:44:19+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2014-04-22T05:48:39+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home\" \/>\n\t\t<meta name=\"twitter:description\" content=\"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#article\",\"name\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b - Slyar Home\",\"headline\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b\",\"author\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"publisher\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#articleImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"},\"datePublished\":\"2010-04-10T16:44:19-07:00\",\"dateModified\":\"2014-04-22T13:48:39-07:00\",\"inLanguage\":\"zh-CN\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#webpage\"},\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#webpage\"},\"articleSection\":\"\\u7f16\\u7a0b\\u76f8\\u5173, \\u7814\\u7a76, \\u7a0b\\u5e8f\\u8bbe\\u8ba1\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"position\":2,\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\",\"item\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#listItem\",\"name\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#listItem\",\"position\":3,\"name\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/category\\\/programing#listItem\",\"name\":\"\\u7f16\\u7a0b\\u76f8\\u5173\"}}]},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\",\"name\":\"Slyar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"}},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar\",\"name\":\"Slyar\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid\",\"width\":96,\"height\":96,\"caption\":\"Slyar\"}},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#webpage\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html\",\"name\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b - Slyar Home\",\"description\":\"C++ class:List x \\u4e0e List x() \\u7684\\u5de8\\u5927\\u5dee\\u522b\",\"inLanguage\":\"zh-CN\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/cpp-constructors-function.html#breadcrumblist\"},\"author\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"creator\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/author\\\/slyar#author\"},\"datePublished\":\"2010-04-10T16:44:19-07:00\",\"dateModified\":\"2014-04-22T13:48:39-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#website\",\"url\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/\",\"name\":\"Slyar Home\",\"description\":\"\\u8bb0\\u5f55\\u4e2a\\u4eba\\u751f\\u6d3b\",\"inLanguage\":\"zh-CN\",\"publisher\":{\"@id\":\"http:\\\/\\\/www.slyar.com\\\/blog\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home","description":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","canonical_url":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html","robots":"max-image-preview:large","keywords":"slyar,c++,class,\u7c7b,\u51fd\u6570,\u8fd4\u56de,\u5b9e\u4f8b,\u5dee\u8ddd","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#article","name":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home","headline":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","author":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"publisher":{"@id":"http:\/\/www.slyar.com\/blog\/#person"},"image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#articleImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"},"datePublished":"2010-04-10T16:44:19-07:00","dateModified":"2014-04-22T13:48:39-07:00","inLanguage":"zh-CN","mainEntityOfPage":{"@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#webpage"},"isPartOf":{"@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#webpage"},"articleSection":"\u7f16\u7a0b\u76f8\u5173, \u7814\u7a76, \u7a0b\u5e8f\u8bbe\u8ba1"},{"@type":"BreadcrumbList","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/#listItem","position":1,"name":"Home","item":"http:\/\/www.slyar.com\/blog\/","nextItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","name":"\u7f16\u7a0b\u76f8\u5173"}},{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","position":2,"name":"\u7f16\u7a0b\u76f8\u5173","item":"http:\/\/www.slyar.com\/blog\/category\/programing","nextItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#listItem","name":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b"},"previousItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/#listItem","name":"Home"}},{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#listItem","position":3,"name":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","previousItem":{"@type":"ListItem","@id":"http:\/\/www.slyar.com\/blog\/category\/programing#listItem","name":"\u7f16\u7a0b\u76f8\u5173"}}]},{"@type":"Person","@id":"http:\/\/www.slyar.com\/blog\/#person","name":"Slyar","image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"}},{"@type":"Person","@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author","url":"http:\/\/www.slyar.com\/blog\/author\/slyar","name":"Slyar","image":{"@type":"ImageObject","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/fa995532c4fa6a1a16430db283689338da430a677b2ff974e0cad68e3bba05c4?s=96&d=monsterid","width":96,"height":96,"caption":"Slyar"}},{"@type":"WebPage","@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#webpage","url":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html","name":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home","description":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","inLanguage":"zh-CN","isPartOf":{"@id":"http:\/\/www.slyar.com\/blog\/#website"},"breadcrumb":{"@id":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html#breadcrumblist"},"author":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"creator":{"@id":"http:\/\/www.slyar.com\/blog\/author\/slyar#author"},"datePublished":"2010-04-10T16:44:19-07:00","dateModified":"2014-04-22T13:48:39-07:00"},{"@type":"WebSite","@id":"http:\/\/www.slyar.com\/blog\/#website","url":"http:\/\/www.slyar.com\/blog\/","name":"Slyar Home","description":"\u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b","inLanguage":"zh-CN","publisher":{"@id":"http:\/\/www.slyar.com\/blog\/#person"}}]},"og:locale":"zh_CN","og:site_name":"Slyar Home | \u8bb0\u5f55\u4e2a\u4eba\u751f\u6d3b","og:type":"article","og:title":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home","og:description":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","og:url":"http:\/\/www.slyar.com\/blog\/cpp-constructors-function.html","article:published_time":"2010-04-10T08:44:19+00:00","article:modified_time":"2014-04-22T05:48:39+00:00","twitter:card":"summary","twitter:title":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - Slyar Home","twitter:description":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b"},"aioseo_meta_data":{"post_id":"1205","title":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b - #site_title","description":"C++ class:List x \u4e0e List x() \u7684\u5de8\u5927\u5dee\u522b","keywords":[{"label":"slyar","value":"slyar"},{"label":"c++","value":"c++"},{"label":"class","value":"class"},{"label":"\u7c7b","value":"\u7c7b"},{"label":"\u51fd\u6570","value":"\u51fd\u6570"},{"label":"\u8fd4\u56de","value":"\u8fd4\u56de"},{"label":"\u5b9e\u4f8b","value":"\u5b9e\u4f8b"},{"label":"\u5dee\u8ddd","value":"\u5dee\u8ddd"}],"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2021-02-10 02:44:47","updated":"2022-10-18 16:51:02","seo_analyzer_scan_date":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null},"_links":{"self":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts\/1205","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/comments?post=1205"}],"version-history":[{"count":0,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/posts\/1205\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/media?parent=1205"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/categories?post=1205"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.slyar.com\/blog\/wp-json\/wp\/v2\/tags?post=1205"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}