C++: The Core Language

Front Cover
"O'Reilly Media, Inc.", 1995 - Computers - 207 pages

C++ is an object-oriented enhancement of the C programming language and is becoming the language of choice for serious software development.C++ has crossed the Single Book Complexity Barrier. The individual features are not all that complex, but when put together in a program they interact in highly non-intuitive ways. Many books discuss each of the features separately, giving readers the illusion that they understand the language. But when they try to program, they're in for a painful surprise (even people who already know C).C++: The Core Language is for C programmers transitioning to C++. It's designed to get readers up to speed quickly by covering an essential subset of the language.The subset consists of features without which it's just not C++, and a handful of others that make it a reasonably useful language. You can actually use this subset (using any compiler) to get familiar with the basics of the language.Once you really understand that much, it's time to do some programming and learn more from other books. After reading this book, you'll be far better equipped to get something useful out of a reference manual, a graphical user interface programming book, and maybe a book on the specific libraries you'll be using. (Take a look at our companion book, Practical C++ Programming.)C++: The Core Language includes sidebars that give overviews of all the advanced features not covered, so that readers know they exist and how they fit in. It covers features common to all C++ compilers, including those on UNIX, Windows NT, Windows, DOS, and Macintosh.Comparison: C++: The Core Language vs.Practical C++ ProgrammingO'Reilly's policy is not to publish two books on the same topic for the same audience. We'd rather spend twice the time on making one book the industry's best. So why do we have two C++ tutorials? Which one should you get?The answer is they're very different. Steve Oualline, author of the successful book Practical C Programming, came to us with the idea of doing a C++ edition. Thus was born Practical C++ Programming. It's a comprehensive tutorial to C++, starting from the ground up. It also covers the programming process, style, and other important real-world issues. By providing exercises and problems with answers, the book helps you make sure you understand before you move on.While that book was under development, we received the proposal forC++: The Core Language. Its innovative approach is to cover only a subset of the language -- the part that's most important to learn first -- and to assume readers already know C. The idea is that C++ is just too complicated to learn all at once. So, you learn the basics solidly from this short book, which prepares you to understand some of the 200+ other C++ books and to start programming.These two books are based on different philosophies and are for different audiences. But there is one way in which they work together. If you are a C programmer, we recommend you start with C++: The Core Language, then read about advanced topics and real-world problems in Practical C++ Programming.

 

What people are saying - Write a review

User Review - Flag as inappropriate

c++

User Review - Flag as inappropriate

An excellent book about c++

Contents

ObjectOriented Programming with Classes
1
Classes
7
C++ Without Classes
9
Function Changes
13
Stricter Typing
18
Dynamic Initialization of Globals
21
Some Final Lists
22
Abstraction with Member Functions
25
An Example Class
119
Using an int
120
Using a Static Array
122
Using a Dynamic Array
123
Using a ReferenceCounted String
126
Copy Constructor Quiz
130
Summary Table
131
Better Hierarchy with Templates
133

Using a struct
26
Using a struct with Interface Functions
27
Using a Class with Member Functions
30
Encapsulation with Access Specifiers
41
A Member Can Have Any Access Level
43
Unlimited Access Specifiers
45
Friend Classes
46
Hierarchy with Composition and Derivation
53
Derivation
54
Chaining
63
Better Abstraction with Constructors and Destructors
65
The Destructor
68
Builtin Types
69
Implicit Default Constructors and Destructors
73
Explicit Invocation
74
Flow of Control
76
Time of Invocation
77
Better Abstraction with new and delete
81
Dynamic Arrays
82
Mixing Allocators
84
Out of Memory
85
References
89
Passing by Value in C and C++
90
Passing by Reference in C++
91
Reference Versus Pointer
92
Returning by Reference in C++
94
Reference Versus Value
95
Binding Problems
96
Better Abstraction with Other Special Member Functions
99
Assignment Operator
100
Copy Constructor
106
Printing an Object
113
Summary
117
Using a Template to Define an Object
136
Careful with That Expansion Eugene
137
Modifying Container Class Elements
138
Polymorphism with Virtual Functions
141
Polymorphism in C
142
Virtual Functions
144
Polymorphism in C++
146
More About Virtual Functions
148
More About Polymorphism
153
Derivation Decisions
156
Virtual Decisions
158
Calling Virtual Functions from Constructors and Destructors
163
Under the Hood
165
Pitfalls
166
Implementing an ObjectOriented Design
169
Implementation Table
170
Examples
171
IsA HasA
173
Defensive Implementation
174
An Example Program
175
The String Class
176
The Rule CwRule and HwRule Classes
177
The Scanner Class
180
Using the Program
181
Example Code
182
What to Study Next
191
const
192
Efficient Copy Constructor
193
C++ Operators
195
One Problem with Returning by Value
197
Bibliography
199
Index
201
Copyright

Common terms and phrases

About the author (1995)

Gregory Satir helps develop online publishing tools in the Portland, Oregon, office of Electronic Book Technologies. He graduated with a B.S. in computer science from Brown University. Doug Brown is a consultant/contractor in Beaverton, Oregon. He has been developing software for circuit simulation, synthesis, and testing since 1977. Doug coauthored lex & yacc, another O'Reilly & Associates Nutshell Handbook. He received an M.S. in electrical engineering from the University of Illinois at Urbana-Champaign in 1976.

Gregory Satir helps develop online publishing tools in the Portland, Oregon, office of Electronic Book Technologies. He graduated with a B.S. in computer science from Brown University.

Bibliographic information