📄 csdn_文档中心_c++中的内部连接与外部连接(一).htm
字号:
<TR>
<TD align=middle height=5></TD>
<TD align=middle width=500></TD></TR>
<TR>
<TD align=middle bgColor=#003399><FONT color=#ffffff>关键字</FONT></TD>
<TD width=500> 声明 定义 内部连接 外部连接 c++</TD></TR>
<TR>
<TD align=middle height=5></TD>
<TD align=middle width=500></TD></TR></TBODY></TABLE><!--文章说明信息结束//-->
<TABLE border=0 width=600>
<TBODY>
<TR>
<TD align=left><BR>
<H1 align=center
style="MARGIN: 17pt 0cm 16.5pt; TEXT-ALIGN: center"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">内部连接与外部连接</SPAN><SPAN
lang=EN-US>(</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">上</SPAN><SPAN
lang=EN-US>)</SPAN></H1>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: blue">SpitFire</SPAN><SPAN
style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">原创,</SPAN><SPAN
lang=EN-US style="COLOR: blue">CSDN</SPAN><SPAN
style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">首发,转贴请说明出处,谢谢。</SPAN><SPAN
lang=EN-US style="COLOR: blue"><?xml:namespace prefix = o ns =
"urn:schemas-microsoft-com:office:office"
/><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
style="COLOR: blue; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">欢迎大家来这里讨论问题</SPAN><SPAN
style="COLOR: blue"> <SPAN
lang=EN-US>http://www.allaboutprogram.com/bb/index.php<o:p></o:p></SPAN></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT size=3> <o:p></o:p></FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'"><FONT
size=3>在说内部连接与外部连接前,先说明一些概念。</FONT></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><FONT size=3> <o:p></o:p></FONT></SPAN></P>
<H2 style="MARGIN: 13pt 0cm"><SPAN lang=EN-US><FONT
face=Arial>1.</FONT></SPAN><SPAN
style="FONT-FAMILY: 黑体; mso-ascii-font-family: Arial">声明</SPAN></H2>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN style="mso-spacerun: yes">
</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">一个声明将一个名称引入一个作用域</SPAN><SPAN
lang=EN-US>;</SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在</SPAN><SPAN
lang=EN-US>c++</SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">中,在一个作用域中重复一个声明是合法的</SPAN><SPAN
lang=EN-US> </SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><SPAN style="mso-tab-count: 1"><FONT
size=3>
</FONT></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">以下都是声明:</SPAN><SPAN
lang=EN-US> </SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN
style="mso-tab-count: 1">
</SPAN><SPAN style="COLOR: green">int foo(int,int); <SPAN
style="mso-tab-count: 1"> </SPAN><SPAN
style="mso-tab-count: 1">
</SPAN>//</SPAN></SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数前置声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>typedef int Int; <SPAN
style="mso-tab-count: 1">
</SPAN><SPAN
style="mso-tab-count: 1">
</SPAN>//typedef </SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>class bar; <SPAN
style="mso-tab-count: 3">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类前置声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>extern int g_var; <SPAN
style="mso-tab-count: 2">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">外部引用声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>class bar; <SPAN
style="mso-tab-count: 3">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">类前置声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>typedef int Int; <SPAN
style="mso-tab-count: 1">
</SPAN><SPAN
style="mso-tab-count: 1">
</SPAN>//typedef </SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>extern int g_var; <SPAN
style="mso-tab-count: 2">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">外部引用声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>friend test; <SPAN
style="mso-tab-count: 3">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">友员声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>using std::cout;<SPAN
style="mso-tab-count: 2">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">名字空间引用声明</SPAN><SPAN
lang=EN-US style="COLOR: green"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>friend test; <SPAN
style="mso-tab-count: 3">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">友员声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>using std::cout; <SPAN
style="mso-tab-count: 1"> </SPAN><SPAN
style="mso-tab-count: 1">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">名字空间引用声明</SPAN><SPAN
lang=EN-US style="COLOR: green"><o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US style="COLOR: green"><SPAN
style="mso-tab-count: 1">
</SPAN>int foo(int,int); <SPAN style="mso-tab-count: 1">
</SPAN><SPAN
style="mso-tab-count: 1">
</SPAN>//</SPAN><SPAN
style="COLOR: green; FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">函数前置声明</SPAN><SPAN
lang=EN-US style="COLOR: green"> <o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><SPAN style="mso-tab-count: 1"><FONT
size=3>
</FONT></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><SPAN
style="FONT-FAMILY: 宋体; mso-ascii-font-family: 'Times New Roman'; mso-hansi-font-family: 'Times New Roman'">在同一个作用域中你可以多次重复这些声明。</SPAN><SPAN
lang=EN-US> </SPAN></FONT></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><SPAN
lang=EN-US><SPAN style="mso-tab-count: 1"><FONT
size=3>
</FONT></SPAN></SPAN></P>
<P class=MsoNormal style="MARGIN: 0cm 0cm 0pt"><FONT size=3><SPAN
lang=EN-US><SPAN
style="mso-tab-count: 1">
</SPAN></SPAN><SPAN
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -