没有合适的资源?快使用搜索试试~ 我知道了~
首页Thinking in C++(第二版)
资源详情
资源评论
资源推荐
Thinking in C++ 2
nd
edition
VERSION TICA13
Revision history:
ToDo: Differentiate copy-assignment operator= from other forms of operator=. HorseRace game as
example of random number generator in early chapter?
TICA13, March 9, 1999. Thorough rewrite of chapter one, including the addition of UML diagram
s. I think chapter one is finished, now. Reorganized material elsewhere in the book, but that is sti
ll in transit. My goal right now is to move through all the chapters in section one, in order.
TICA12, January 15, 1999. Lots of work done on the Design Patterns chapter. All the exsting pro
grams are now modified and redesigned (significantly!) to compile under C++. Added several new
examples. Much of the prose in this chapter still needs work, and more patterns and examples ar
e forthcoming. Changed ExtractCode.cpp so that it generates "bugs" targets for each makefile, cont
aining all the files that won't compile with a particular compiler so they can be re-checked with n
ew compilers. Generates a master in the book's root directory called makefile.bugs which descends
into each subdirectory and executes make with "bugs" as a target and the 杋 flag so you'll see
all the errors.
TICA11, January 7, 1999. Completed the STL Algorithms chapter (significant additions and change
s), edited and added examples the STL containers chapter. Added many exercises at the ends of b
oth chapters. I consider these both completed now. Added an example or two to the strings chapte
r.
TICA10, December 28, 1998. Complete rewrite of the ExtractCode.cpp program to automatically
generate makefiles for each compiler that the book tests, excluding files that the compiler can't ha
ndle (these are in a special list in the appendices, so you can see what breaks a compiler, and yo
u can create your own). You now don't need to extract the files yourself (although you still can,
for special cases) but instead you just download and unzip a file. All the files in the book (with t
he exception of the files that are still in Java) now compile with at least one Standard C++ comp
iler. Added the trim.h, SiteMapConvert.cpp and StringCharReplace.cpp examples to the strings
chapter. Added the ProgVals example to chapter 20. Removed all the strlwr() uses (it's a non-st
andard function).
TICA9, December 15, 1998. Massive work completed on the STL Algorithms chapter; it's quite cl
ose to being finished. The long delay was because (1) This chapter took a lot of research and thi
nking, including other research such as templates; you'll notice the "advanced templates" chapter ha
s more in it's outline (2) I was traveling and giving seminars, etc. I'm entering a two-month hiatu
s where I'm primarily working on the book and should get a lot accomplished.
TICA8, September 26, 1998. Completed the STL containers chapter.
TICA7, August 14, 1998. Strings chapter modified. Other odds and ends.
TICA6, August 6, 1998. Strings chapter added, still needs some work but it's in fairly good shap
e. The basic structure for the STL Algorithms chapter is in place and "just" needs to be filled ou
t. Reorganized the chapters; this should be very close to the final organization (unless I discover I'
ve left something out).
TICA5, August 2, 1998: Lots of work done on this version. Everything compiles (except for the d
esign patterns chapter with the Java code) under Borland C++ 5.3. This is the only compiler that
even comes close, but I have high hopes for the next verison of egcs. The chapters and organizati
on of the book is starting to take on more form. A lot of work and new material added in the "
STL Containers" chapter (in preparation for my STL talks at the Borland and SD conferences), alt
hough that is far from finished. Also, replaced many of the situations in the first edition where I
used my home-grown containers with STL containers (typically vector). Changed all header include
s to new style (except for C programs): <iostream> instead of <iostream.h>, <cstdlib> instead of
<stdlib.h>, etc. Adjustment of namespace issues ("using namespace std" in .cpp files, full qualific
ation of names in header files). Added appendix A to describe coding style (including namespace
s). Added "require.h" error testing code and used it universally. Rearranged header include order t
o go from more general to more specific (consistency and style issue described in appendix A). R
eplaced 'main() {}' form with 'int main() { }' form (this relies on the default "return 0" behavi
or, although some compilers, notably VC++, give warnings). Went through and implemented the cl
ass naming policy (following the Java/Smalltalk policy of starting with uppercase etc.) but not the
member functions/data members (starting with lowercase etc.). Added appendix A on coding style.
Tested code with my modified version of Borland C++ 5.3 (cribbed a corrected ostream_iterator fr
om egcs and <sstream> from elsewhere) so not all the programs will compile with your compiler
(VC++ in particular has a lot of trouble with namespaces). On the web site, I added the broken-u
p versions of the files for easier downloads.
TICA4, July 22, 1998: More changes and additions to the "CGI Programming" section at the end
of Chapter 23. I think that section is finished now, with the exception of corrections.
TICA3, July 14, 1998: First revision with content editing (instead of just being a posting to test t
he formatting and code extraction process). Changes in the end of Chapter 23, on the "CGI Progr
amming" section. Minor tweaks elsewhere. RTF format should be fixed now.
TICA2, July 9, 1998: Changed all fonts to Times and Courier (which are universal); changed distr
ibution format to RTF (readable by most PC and Mac Word Processors, and by at least one on L
inux: StarOffice from www.caldera.com. Please let me know if you know about other RTF word p
rocessors under Linux).
__________________________________________________________________________
The instructions on the web site (http://www.BruceEckel.com/ThinkingInCPP2e.html) show you how
to extract code for both Win32 systems and Linux (only Red Hat Linux 5.0/5.1 has been tested).
The contents of the book, including the contents of the source-code files generated during automa
tic code extraction, are not intended to indicate any accurate or finished form of the book or sour
ce code.
Please only add comments/corrections using the form found on http://www.BruceEckel.com/Thinking
InCPP2e.html
Please note that the book files are only available in Rich Text Format (RTF) or plain ASCII text
without line breaks (that is, each paragraph is on a single line, so if you bring it into a typical te
xt editor that does line wrapping, it will read decently). Please see the Web page for information
about word processors that support RTF. The only fonts used are Times and Courier (so there sho
uld be no font difficulties); if you find any other fonts please report the location.
Thanks for your participation in this project.
Bruce Eckel
"This book is a tremendous achievement. You owe it to yourself to have a copy
on your shelf. The chapter on iostreams is the most comprehensive and understan
dable treatment of that subject I've seen to date."
Al Stevens
Contributing Editor, Doctor Dobbs Journal
"Eckel's book is the only one to so clearly explain how to rethink program constr
uction for object orientation. That the book is also an excellent tutorial on the ins
and outs of C++ is an added bonus."
Andrew Binstock
Editor, Unix Review
"Bruce continues to amaze me with his insight into C++, and Thinking in C++ is
his best collection of ideas yet. If you want clear answers to difficult questions
about C++, buy this outstanding book."
Gary Entsminger
Author, The Tao of Objects
"Thinking in C++ patiently and methodically explores the issues of when and ho
w to use inlines, references, operator overloading, inheritance and dynamic objects,
as well as advanced topics such as the proper use of templates, exceptions and
multiple inheritance. The entire effort is woven in a fabric that includes Eckel's o
wn philosophy of object and program design. A must for every C++ developer's b
ookshelf, Thinking in C++ is the one C++ book you must have if you're doing s
erious development with C++."
Richard Hale Shaw
Contributing Editor, PC Magazine
Thinking
In
C++
Bruce Eckel
President, MindView Inc.
Prentice Hall PTR
Upper Saddle River, New Jersey 07458
http://www.phptr.com Publisher: Alan Apt
Production Editor: Mona Pompilli
Development Editor: Sondra Chavez
Book Design, Cover Design and Cover Photo:
Daniel Will-Harris, daniel@will-harris.com
Copy Editor: Shirley Michaels
Production Coordinator:Lori Bulwin
Editorial Assistant: Shirley McGuire
1998 by Bruce Eckel, MindView, Inc.
Published by Prentice Hall Inc.
A Paramount Communications Company
Englewood Cliffs, New Jersey 07632
The information in this book is distributed on an "as is" basis, without warranty. While every precaution has
been taken in the preparation of this book, neither the author nor the publisher shall have any liability to a
ny person or entitle with respect to any liability, loss or damage caused or alleged to be caused directly or i
ndirectly by instructions contained in this book or by the computer software or hardware products described h
erein.
All rights reserved. No part of this book may be reproduced in any form or by any electronic or mechanical
means including information storage and retrieval systems without permission in writing from the publisher o
r author, except by a reviewer who may quote brief passages in a review. Any of the names used in the exa
mples and text of this book are fictional; any relationship to persons living or dead or to fictional characters
in other works is purely coincidental.
Printed in the United States of America
10 9 8 7 6 5 4 3 2 1
ISBN 0-13-917709-4
Prentice-Hall International (UK) Limited, London
Prentice-Hall of Australia Pty. Limited, Sydney
Prentice-Hall Canada, Inc., Toronto
Prentice-Hall Hisapnoamericana, S.A., Mexico
Prentice-Hall of India Private Limited, New Delhi
Prentice-Hall of Japan, Inc., Tokyo
Simon & Schuster Asia Pte. Ltd., Singapore
Editora Prentice-Hall do Brasil, Ltda., Rio de Janeirodedication
to the scholar, the healer, and the muse
What's inside...
Thinking in C++ 2
nd
edition VERSION TICA13 1
Preface 17
Prerequisites 17
Thinking in C 17
Learning C++ 18
Goals 19
Chapters 20
Exercises 24
Source code 24
Coding standards 25
Language standards 26
Language support 26
Seminars & CD Roms 27
Errors 27
Acknowledgements 27
1: Introduction to objects 29
The progress of abstraction 29
An object has an interface 31
The hidden implementation 33
Reusing the implementation 34
Inheritance: reusing the interface 35
Is-a vs. is-like-a relationships 39
Interchangeable objects with polymorphism 40
Abstract base classes and interfaces Error! Bookmark not defined.
Creating and destroying objects 43
Exception handling: dealing with errors 44
Analysis and design 45
Phase 0: Make a plan 47
Phase 1: What are we making? 48
Phase 2: How will we build it? 50
Phase 3: Build it 53
Phase 4: Iteration 53
Plans pay off 55
Why C++ succeeds 55
A better C 55
You're already on the learning curve 56
Efficiency 56
Systems are easier to express and understand 56
Maximal leverage with libraries 57
Source-code reuse with templates 57
Error handling 57
Programming in the large 57
Strategies for transition 58
Management obstacles 59
Summary 61
2: Making & using objects 63
The process of language translation 63
Interpreters 63
Compilers 64
The compilation process 65
Tools for separate compilation 66
Declarations vs. definitions 66
Linking 70
Using libraries 70
Your first C++ program 72
Using the iostreams class 72
Fundamentals of program structure 72
"Hello, world!" 73
Running the compiler 74
More about iostreams 74
String concatenation 75
Reading input 75
Simple file manipulation 76
Summary 77
Exercises 77
3: The C in C++ 79
Controlling execution in C/C++ 79
True and false in C 79
if-else 80
while 81
do-while 82
for 82
The break and continue Keywords 83
switch 85
Introduction to C and C++ operators 86
Precedence 87
Auto increment and decrement 87
Using standard I/O for easy file handling 88
Simple "cat" program 88
Handling spaces in input 89
Utility programs using iostreams and standard I/O 91
Pipes 91
Text analysis program 92
IOstream support for file manipulation 93
Introduction to C++ data 94
剩余358页未读,继续阅读
Jack-Lee
- 粉丝: 0
- 资源: 15
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 2022年中国足球球迷营销价值报告.pdf
- 房地产培训 -营销总每天在干嘛.pptx
- 黄色简约实用介绍_汇报PPT模板.pptx
- 嵌入式系统原理及应用:第三章 ARM编程简介_3.pdf
- 多媒体应用系统.pptx
- 黄灰配色简约设计精美大气商务汇报PPT模板.pptx
- 用matlab绘制差分方程Z变换-反变换-zplane-residuez-tf2zp-zp2tf-tf2sos-sos2tf-幅相频谱等等.docx
- 网络营销策略-网络营销团队的建立.docx
- 电子商务示范企业申请报告.doc
- 淡雅灰低面风背景完整框架创业商业计划书PPT模板.pptx
- 计算模型与算法技术:10-Iterative Improvement.ppt
- 计算模型与算法技术:9-Greedy Technique.ppt
- 计算模型与算法技术:6-Transform-and-Conquer.ppt
- 云服务安全风险分析研究.pdf
- 软件工程笔记(完整版).doc
- 电子商务网项目实例规划书.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5