📄 eimplc.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 | Classes and Functions: Implementation</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 = "EIMPLDIR.HTM";
var dingtext = "EC++ Class/Func Impl, P";
if (self == top) {
top.location.replace(dingbase + this.location.hash);
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" ONLOAD="setResize()">
<!-- SectionName="EC++ Chapter Intro: Impl of Classes/Functions" -->
<DIV ALIGN="CENTER"><FONT SIZE="-1">Back to <A HREF="./EI28_FR.HTM" TARGET="_top">Item 28: Partition the global namespace.</A> <BR> Continue to <A HREF="./EI29_FR.HTM" TARGET="_top">Item 29: Avoid returning "handles" to internal data.</A></FONT></DIV>
<P><A NAME="dingp1"></A><A NAME="p123"></A><FONT ID="egtitle">Classes and Functions: Implementation</FONT><SCRIPT>create_link(1);</SCRIPT>
</P>
<A NAME="6485"></A>
<A NAME="6486"></A>
<P><A NAME="dingp2"></A>
Because C++ is strongly typed, coming up with appropriate definitions for your classes and templates and appropriate declarations for your functions is the lion's share of the battle. Once you've got those right, it's hard to go wrong with the template, class, and function implementations. Yet, somehow, people manage to do <NOBR>it.<SCRIPT>create_link(2);</SCRIPT>
</NOBR></P>
<A NAME="6487"></A>
<P><A NAME="dingp3"></A>
Some problems arise from inadvertently violating abstraction: accidentally allowing implementation details to peek out from behind the class and function boundaries that are supposed to contain them. Others originate in confusion over the length of an object's lifetime. Still others stem from premature optimization, typically traceable to the seductive nature of the <CODE>inline</CODE> keyword. Finally, some implementation strategies, while fine on a local scale, result in levels of coupling between source files that can make it unacceptably costly to rebuild large <NOBR>systems.<SCRIPT>create_link(3);</SCRIPT>
</NOBR></P>
<A NAME="6488"></A>
<P><A NAME="dingp4"></A>
Each of these problems, as well as others like them, can be avoided if you know what to watch out for. The items that follow identify some situations in which you need to be especially <NOBR>vigilant.<SCRIPT>create_link(4);</SCRIPT>
</NOBR></P>
<DIV ALIGN="CENTER"><FONT SIZE="-1">Back to <A HREF="./EI28_FR.HTM" TARGET="_top">Item 28: Partition the global namespace.</A> <BR> Continue to <A HREF="./EI29_FR.HTM" TARGET="_top">Item 29: Avoid returning "handles" to internal data.</A></FONT></DIV>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -