⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eshiftc.htm

📁 一个非常适合初学者入门的有关c++的文档
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN" "http://www.w3.org/TR/REC-html40/frameset.dtd">
<HTML LANG="EN">
<HEAD>
<title>Effective C++, 2E | Shifting from C to C++</TITLE>
<LINK REL=STYLESHEET HREF=../INTRO/ECMEC.CSS>

<SCRIPT LANGUAGE="Javascript" SRC="../JAVA/COOKIE.JS"></SCRIPT>
<SCRIPT LANGUAGE="Javascript">var imagemax = 0; setCurrentMax(0);</SCRIPT>
<SCRIPT LANGUAGE="Javascript" SRC="../JAVA/DINGBATS.JS"></SCRIPT>
<SCRIPT>
var dingbase = "ESHIFDIR.HTM";
var dingtext = "EC++ C to C++, P";
if (self == top) {
 top.location.replace(dingbase + this.location.hash);
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" ONLOAD="setResize()">
<!-- SectionName="EC++ Chapter Intro: Shifting from C to C++" -->
<DIV ALIGN="CENTER"><FONT SIZE="-1">Back to <A HREF="./EIINTRFR.HTM" TARGET="_top">Introduction</A> &nbsp;&nbsp;<BR>&nbsp;&nbsp;Continue to <A HREF="./EI1_FR.HTM" TARGET="_top">Item 1: Prefer const and inline to #define.</A></FONT></DIV>

<P><A NAME="dingp1"></A><A NAME="p13"></A><FONT ID="egtitle">Shifting from C to C++</FONT><SCRIPT>create_link(1);</SCRIPT>
</P>

<A NAME="222823"></A>

<A NAME="222826"></A>
<P><A NAME="dingp2"></A>
Getting used to C++ takes a little while for everyone, but for grizzled C programmers, the process can be especially unnerving. Because C is effectively a subset of C++, all the old C tricks continue to work, but many of them are no longer appropriate. To C++ programmers, for example, a pointer to a pointer looks a little funny. Why, we wonder, wasn't a reference to a pointer used <NOBR>instead?<SCRIPT>create_link(2);</SCRIPT>
</NOBR></P>
<A NAME="1787"></A>
<P><A NAME="dingp3"></A>
C is a fairly simple language. All it really offers is macros, pointers, structs, arrays, and functions. No matter what the problem is, the solution will always boil down to macros, pointers, structs, arrays, and functions. Not so in C++. The macros, pointers, structs, arrays and functions are still there, of course, but so are private and protected members, function overloading, default parameters, constructors and destructors, user-defined operators, inline functions, references, friends, templates, exceptions, namespaces, and more. The design space is much richer in C++ than it is in C: there are just a lot more options to <NOBR>consider.<SCRIPT>create_link(3);</SCRIPT>
</NOBR></P>
<A NAME="1788"></A>
<P><A NAME="dingp4"></A>
When faced with such a variety of choices, many C programmers hunker down and hold tight to what they're used to. For the most part, that's no great sin, but some C habits run contrary to the spirit of C++. Those are the ones that have simply <I>got</I> to <NOBR>go.<SCRIPT>create_link(4);</SCRIPT>
</NOBR></P>

<DIV ALIGN="CENTER"><FONT SIZE="-1">Back to <A HREF="./EIINTRFR.HTM" TARGET="_top">Introduction</A> &nbsp;&nbsp;<BR>&nbsp;&nbsp;Continue to <A HREF="./EI1_FR.HTM" TARGET="_top">Item 1: Prefer const and inline to #define.</A></FONT></DIV>

</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -