[컴퓨터/IT수험서] [C++기초플러스 3판]-원서(정오표)
- Stephen Prata
- 0
- 8,955
- 2001-04-14 00:00:00
- Download
- errata.doc 2001-04-140
Errata for C++ Primer Plus. 3rd Edition
Chapter 2
p41, Figures 2.6 and 2.7
replace 6 + 25 with 6.25
Chapter 4
p153, PE 5
exercise 2 should be exercise 5
Chapter 9
page 372, 373
The paragraph on page 372 beginning on with "Let's see" and the sidebar on page 373 beginning with "Let's see" are supposed to be the same typographic element, one that is neither standard text nor a sidebar. See 2nd edition, which simply indents the two paragraphs to set them off.
page 388, mid page
int year = 2001
should be
int year = 2001;
p390, first line
either move no! to the end of the first line or else move the comment marks to the second line so it reads
// no!
Chapter 11
P537
In PE 1,
replace
Cow operator=(const Cow & c);
with
Cow & operator=(const Cow & c);
P539
In PE 4,
replace
Stack operator=(const Stack & st);
with
Stack & operator=(const Stack & st);
Chapter 12
p570, near top
~virtual ~BaseClass() {}
should be
virtual ~BaseClass() {}
p583, class BaseEllipse code.
second private should be public
page 583, near end of code:
virtual Area() const = 0;
should be
virtual double Area() const = 0;
p595
The heading Exercises should be Programming Exercises
In exercise 1, insert the following sentence before "test your product with the following program:"
Identify and remove unneeded methods, if any.
P596, near end of listing:
replace
void bravo(Cd & disk
with
void Bravo(const Cd & disk)
Chapter 13
Page 633, Listing 13.13
Replace
template
ArrayTP::ArrayTP()
{
for (int i = 0; i < n; i++)
ar[i] = 0;
}
with
template
ArrayTP::ArrayTP()
{
// each element is set to the default
// value, if any, of type T
}
Chapter 14
p703, last line:
replace
throw oops();
with
throw problem();
Chapter 15
p 736, Table 15.1
Third entry is scrambled; it should be like this (note that const string & str replaces the erroneous const string * str):
string(const string & str, size_type pos = 0,size_type n = npos) Initializes the string object to the string object str, starting at position pos in str and going to the end of str or using n characters, whichever comes first.
P807, end of listing 15-13
I'm not sure if this a standards issue or an implementation issue, but CW Pro 4 requires the following replacement:
string & ToLower(string & st)
{
transform(st.begin(), st.end(), st.begin(), tolower);
return st;
}
with
string & ToLower(string & s)
{
transform(s.begin(), s.end(), s.begin(), (int (*)(int))tolower);
return s;
}
p810
Question 2 should be a continuation of question 1, hence question 3 should be question 2, etc.
Appendix J
Page 999, Chapter 12
(current answer to #3 is holdover from 2nd edition, but the question was changed. Here is a new answer.)
3. First, the return value is only if you use the value of an assignment expression, as when you chain assignment. That is, in a statement like
A = B = C;
the return value of
B.operator=(C);
gets assigned to A. For this purpose, returning an object instead of a reference works. However, returning an object means constructing a temporary object to hold the return value, so it is slower than using a reference.