<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>FAQ | 酷 壳 - CoolShell</title>
	<atom:link href="https://coolshell.cn/tag/faq/feed" rel="self" type="application/rss+xml" />
	<link>https://coolshell.cn</link>
	<description>享受编程和技术所带来的快乐 - Coding Your Ambition</description>
	<lastBuildDate>Wed, 13 May 2009 15:07:45 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.2</generator>
	<item>
		<title>关于C++构造函数的FAQ</title>
		<link>https://coolshell.cn/articles/804.html</link>
					<comments>https://coolshell.cn/articles/804.html#respond</comments>
		
		<dc:creator><![CDATA[陈皓]]></dc:creator>
		<pubDate>Wed, 13 May 2009 14:38:36 +0000</pubDate>
				<category><![CDATA[C/C++语言]]></category>
		<category><![CDATA[编程语言]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[FAQ]]></category>
		<guid isPermaLink="false">http://coolshell.cn/?p=804</guid>

					<description><![CDATA[<p>下面是一些关于C++构造函数的FAQ。你能回答得出来吗？你可以点链接查看答案，不过是英文版的。他们来自于C++ FAQ Lite。当然，也有中文版的，只可惜中文...</p>
<p class="read-more"><a class="btn btn-default" href="https://coolshell.cn/articles/804.html"> Read More<span class="screen-reader-text">  Read More</span></a></p>
The post <a href="https://coolshell.cn/articles/804.html">关于C++构造函数的FAQ</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></description>
										<content:encoded><![CDATA[<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3415450859608158"
     crossorigin="anonymous"></script>下面是一些关于C++构造函数的FAQ。你能回答得出来吗？你可以点链接查看答案，不过是英文版的。他们来自于<a title="C++ FAQ Lite" href="http://www.parashift.com/c++-faq-lite/index.html"><em>C++ FAQ Lite</em></a>。当然，也有中文版的，只可惜中文版的太老了，只更新到了2001年。在<a title="C++ FAQ Lite" href="http://www.parashift.com/c++-faq-lite/index.html"><em>C++ FAQ Lite</em></a>上还有很多关于其它部分的FAQ，大家可以去看看。</p>
<p><a title="[1] What's the deal with constructors?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.1">[1] 构造函数是用来干什么的？</a></p>
<p><a title="[2] Is there any difference between List x; and List x();?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.2">[2] <tt>List x;</tt> 和 <tt>List x();有什么不同</tt>?</a></p>
<p><a title="[3] Can one constructor of a class call another constructor of the same class to initialize the this object?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.3">[3] 是否一个类的构造函数可以调用另一个构造函数来初始化自己？</a></p>
<p><a title="[4] Is the default constructor for Fred always Fred::Fred()?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.4">[4] 是否Fred类的默认的函数函数就一定是<tt>Fred::Fred()？</tt></a></p>
<p><a title="[5] Which constructor gets called when I create an array of Fred objects?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.5">[5] 如果要创建一个<tt>Fred</tt> 对像数组，什么样的构数函数会被调用?</a></p>
<p><a title="[6] Should my constructors use &quot;initialization lists&quot; or &quot;assignment&quot;?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.6">[6] 构造函数初始化成员变量时，用 &#8220;初始化列表&#8221; 还是 “赋值”？</a></p>
<p><span id="more-804"></span></p>
<p><a title="[7] Should you use the this pointer in the constructor?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.7">[7] 在构造函数中用<tt>this</tt> 指针是否有问题？</a></p>
<p><a title="[8] What is the &quot;Named Constructor Idiom&quot;?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.8">[8]什么是“名字构造函数”（Named Constructor Idiom）？</a></p>
<p><a title="[9] Does return-by-value mean extra copies and extra overhead?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.9">[9] “值返回”意味着额外的拷贝吗？</a></p>
<p><a title="[10] Why can't I initialize my static member data in my constructor's initialization list?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.10">[10] 为什么我们不能在构造函数初始化列表中初始化一个 <tt>static</tt> 成员变量？</a></p>
<p><a title="[11] Why are classes with static data members getting linker errors?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.11">[11] 为什么一个有 <tt>static</tt> 成员变量的类会有链接错误？</a></p>
<p><a title="[12] What's the &quot;static initialization order fiasco&quot;?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.12">[12] 什么是“<tt>static</tt> initialization order fiasco”？</a></p>
<p><a title="[13] How do I prevent the &quot;static initialization order fiasco&quot;?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.13">[13] 我该如果避免 “<tt>static</tt> initialization order fiasco”?</a></p>
<p><a title="[14] Why doesn't the construct-on-first-use idiom use a static object instead of a static pointer?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.14">[14] 为什么 construct-on-first-use 什么静态变量而不是指针？</a></p>
<p><a title="[15] How do I prevent the &quot;static initialization order fiasco&quot; for my static data members?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.15">[15] 怎么才能避免静态成员中的“<tt>static</tt> initialization order fiasco” ？</a></p>
<p><a title="[16] Do I need to worry about the &quot;static initialization order fiasco&quot; for variables of built-in/intrinsic types?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.16">[16] 我是否要为内建类型的“<tt>static</tt> initialization order fiasco”而担心？</a></p>
<p><a title="[17] How can I handle a constructor that fails?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.17">[17] 如果构造函数出错了怎么办？</a></p>
<p><a title="[18] What is the &quot;Named Parameter Idiom&quot;?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.18">[18] 什么是“命名参数惯用法”（Named Parameter Idiom）？</a></p>
<p><a title="[19] Why am I getting an error after declaring a Foo object via Foo x(Bar())?" href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.19">[19] 为什么我通过<tt>Foo x(Bar())</tt>声明一个<tt>Foo</tt> 对象会得到一个错误？</a><!--



<p align="center"><a href= target=_blank><img decoding="async" src=""></a></p>





<p align="center"><img decoding="async" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.weixin.jpg"> <img decoding="async" loading="lazy" src="https://coolshell.cn/wp-content/uploads/2020/03/coolshell.mini_.jpg" width="300" height="300"> <br />关注CoolShell微信公众账号和微信小程序</p>

 

--></p>
<div style="margin-top: 15px; font-size: 16px;color: #cc0000;">
<p align="center"><strong>（转载本站文章请注明作者和出处 <a href="https://coolshell.cn/">酷 壳 &#8211; CoolShell</a> ，请勿用于任何商业用途）</strong></p>
</div>

<div class="wp_rp_wrap  wp_rp_vertical_m" id="wp_rp_first"><div class="wp_rp_content"><h3 class="related_post_title">相关文章</h3><ul class="related_post wp_rp"><li ><a href="https://coolshell.cn/articles/20845.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2020/03/rust-social-wide-150x150.jpg" alt="Rust语言的编程范式" width="150" height="150" /></a><a href="https://coolshell.cn/articles/20845.html" class="wp_rp_title">Rust语言的编程范式</a></li><li ><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2018/05/300x262-150x150.jpg" alt="程序员练级攻略（2018)  与我的专栏" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18360.html" class="wp_rp_title">程序员练级攻略（2018)  与我的专栏</a></li><li ><a href="https://coolshell.cn/articles/18024.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2017/07/api-design-300x278-2-150x150.jpg" alt="API设计原则 &#8211; Qt官网的设计实践总结" width="150" height="150" /></a><a href="https://coolshell.cn/articles/18024.html" class="wp_rp_title">API设计原则 &#8211; Qt官网的设计实践总结</a></li><li ><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/plugins/wordpress-23-related-posts-plugin/static/thumbs/29.jpg" alt="Leetcode 编程训练" width="150" height="150" /></a><a href="https://coolshell.cn/articles/12052.html" class="wp_rp_title">Leetcode 编程训练</a></li><li ><a href="https://coolshell.cn/articles/12012.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2014/10/edsm-150x150.gif" alt="State Threads 回调终结者" width="150" height="150" /></a><a href="https://coolshell.cn/articles/12012.html" class="wp_rp_title">State Threads 回调终结者</a></li><li ><a href="https://coolshell.cn/articles/11466.html" class="wp_rp_thumbnail"><img src="https://coolshell.cn/wp-content/uploads/2014/04/c99-150x150.jpg" alt="C语言的整型溢出问题" width="150" height="150" /></a><a href="https://coolshell.cn/articles/11466.html" class="wp_rp_title">C语言的整型溢出问题</a></li></ul></div></div>The post <a href="https://coolshell.cn/articles/804.html">关于C++构造函数的FAQ</a> first appeared on <a href="https://coolshell.cn">酷 壳 - CoolShell</a>.]]></content:encoded>
					
					<wfw:commentRss>https://coolshell.cn/articles/804.html/feed</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
