ERRATA
for
Programming with Objects

NOTE ON THE SECOND PRINTING All the corrections listed below prior to April 1, 2005 have been incorporated in the second printing that was released by the publisher in the middle of June 2005.


Entries made on March 18, 2013: pages 32 and 410 (two corrections)
Entries made on August 11, 2006: pages 245, 514, 515 (two corrections), 517 (two corrections), and 534
Entries made on October 4, 2005: page 18 (two corrections)
Entries made on July 27, 2005: pages 382 and 912
Entries made on June 30, 2005: pages 8 and 250 (third correction)
Entries made on May 18, 2005: pages 1029-1030 and 1041-1043

All corrections listed below have been incorporated in the second printing of the book

Entries made on February 8, 2005: pages 727, 736 (additional correction), 970, and 1002 (second correction)

Entries made on February 7, 2005: pages 478 (two corrections), 724 (two corrections), 726
Entries made on January 10, 2005: pages 525, 526 (second correction), and 527
Entry made on October 27, 2004: page 372
Entries made on October 26, 2004: page 22 (three additional corrections)
Entries made on October 25, 2004: pages 56, 72, 323, 324, 376, 397 (two corrections), 398, 419, 505, 536, 537, 647, 744, 1040, 1077, 1079
Entries made on October 22, 2004: pages 539, 540 (second correction), 541 (two corrections), 542, 543, 561, 563 (three corrections)
Entries made on October 21, 2004: pages 157 (second correction), 168, 171, 174, 175, 177, 179, and 181
Entries made on October 20, 2004: pages 21 (second correction), 22, 118, 121 (additional correction), 125, 127, 128
Entries made on October 19, 2004: 248, 250 (two corrections), 251 (three corrections), 256, and 427
Entries made on October 18, 2004: pages 232, 233 (second correction), 240, 241, 245, and 247
Entries made on October 5, 2004: pages 315 (two corrections), 359, and 1085
Entry made on September 22, 2004: page 148
Entry made on September 12, 2004: page 890
Entry made on July 15, 2004: page 53
Entries made on April 18, 2004: pages 293, 1049, and 1058
Entries made on March 27, 2004: pages 565, 934, 941, 942, 955, and 1027
Entries made on March 5, 2004: pages 233, 302, 990 (two corrections), and 1002
Entries made on Feb. 26, 2004: pages 25, 137, 158, 932, and 975
Entries made on Feb. 8, 2004: pages 79 (a third correction), 243, 648, 736, and 776
Entries made on Jan. 15, 2004: pages 142 (a second correction), 160, 203, and 312
Entries made on Dec. 20, 2003: pages 79 (two corrections), 141
Entries made on Dec. 5, 2003: pages 202, 204, 558, and 601
Entries made on Nov. 16, 2003: pages 307, 313, 321 (a third correction), 325, 343, 364, 511, 526, and 540
Entries made on Nov. 6, 2003: pages 121 (a second correction), 299, 335, 346, 371, and 443
Entries made on Oct. 8, 2003: pages 133 (two corrections), 157, 169, and 321 (two corrections).
Entries made on Sept. 12, 2003: pages 44, 66, 119, and 257.
Entries made on Sept. 2, 2003: pages 36, 42, a second correction for page 43.
Entries made on Aug. 29, 2003: pages 13, 21, 297, and 1110.
Previous entries (about 10) were made prior to May 8, 2003.


NOTE ON THE TABLE BORDER COLOR USED

If you have purchased a copy of the second printing of the book, only the tables with blue border apply to you.




Page ix of Table of Contents:
(fixed in the second printing of the book)
The entries for Sections   5.1.1.1,   5.1.1.2,   and   5.1.1.3   should be
indented to the right. As currently printed, they are indented to the left.

Page 3:   Line 14 of the second paragraph
(fixed in the second printing of the book)
line as currently set: example, polymorphism can only be invoked through pointers, a fact that can have a
corrected version: example, polymorphism can only be invoked through pointers and references, a fact that can have a

Page 8:  Line 4 of the first paragraph below the code
line as currently set: to the standard output stream, which would generally be directed to the window
corrected version: to the standard output, which would generally be directed to the window

Page 13:   Line 5 of the last complete paragraph
(fixed in the second printing of the book)
line as currently set: the Java compiler. println() is a method defined for the class OutputStream. One
corrected version: the Java compiler. One

Page 18:  Third line from the top of the page
line as currently set:            && ch != ’\n’ )
corrected version:            && ch != ’\n’ && ch != ’\r’ )
NOTE: The program TermIO.java as shown in the book works fine on Unix and Linux machines, but will run into the 'line terminator problem' on Windows and Mac machines. The correction shown here, along with the correction shown next, should make the program work on all platforms.

Page 18:  Fifth line from the top of the page
line as currently set:     if ( ch == ’\n’ ) newline = true;
corrected version:     if ( ch == ’\n’ || ch == ’\r’ ) newline = true;
NOTE: The program TermIO.java as shown in the book works fine on Unix and Linux machines, but will run into the 'line terminator problem' on Windows and Mac machines. The correction shown here, along with the previous correction, should make the program work on all platforms.

Page 21:  The beginning section of the program FileCopy.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 #include <cstdlib>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 #include <cstdlib>
 using namespace std;

Page 21:   The code line labeled  //(C)  in the middle of the page
(fixed in the second printing of the book)
line as currently set:    void print_error(const char*, const char* = " ");  //(C)
corrected version:    void print_error(const char*, const char* = "");   //(C)
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 22:  Last line of the first paragraph
(fixed in the second printing of the book)
line as currently set: in the header fstream are defined in the namespace std.
corrected version: in the included header files are defined in the namespace std.

Page 22:  First line of the last paragraph
(fixed in the second printing of the book)
line as currently set:   The actual file-to-file copy takes place in lines (H) and (I). In line (G), the function
corrected version:   The actual file-to-file copy takes place in lines (H) and (I). In line (H), the function

Page 22:  First line of the footnote 17 at the bottom of the page
(fixed in the second printing of the book)
line as currently set: The fstream header file includes the iostream header file. See Chapter 6 for the C++ iostream
corrected version: The program shown also includes the iostream header file for cerr. See Chapter 6 for the C++ stream

Page 22:  The first two lines of the footnote 20 at the bottom of the page
(fixed in the second printing of the book)
lines as currently set: The classes ifstream and ofstream are subclasses of the class iostream. They inherit all the public attributes of the parent class iostream and in addition have their own specailized attributes for file
corrected version: The class ifstream is a subclass of istream and the class ofstream is a subclass of ostream. They inherit all the public attributes of the parent classes and in addition have their own specialized attributes for file

Page 24:   The code line beginning with   java   in the bottom half of the page
(fixed in the second printing of the book)
line as currently set:     java   fileIODemo   sourceFile   destinationFile
corrected version:     java   FileCopy   sourceFile   destinationFile
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 24:   Second line after the previous correction
(fixed in the second printing of the book)
line as currently set: and args[1] to destFile.
corrected version: and args[1] to destinationFile.

Page 25:  The paragraph that begins with "The basic reference for C++ ...."
(fixed in the second printing of the book)

Switch the first two sentences of the paragraph that begins with the phrase "The basic reference for C++ is the book by......".

As currently set, a reader may mistakenly believe that the phrase "Chapters 6 and 10 of this book" in the second sentence refers to the Stroustrup reference of the first sentence.


Page 29:   Line 2 of the first paragraph
(fixed in the second printing of the book)
line as currently set: of that knowledge. The following words/phrases represent the concepts that are most
corrected version: of that knowledge. The following words represent the concepts that are most

Page 32:   Line 4 of the paragraph that begins with "So, in a nutshell,..." in the middle of the page
line as currently set: in different class and for automatic invocation of object-specific definitions of such
corrected version: in different classes and for automatic invocation of object-specific definitions of such

Page 36:   Line 4 of the last paragraph
(fixed in the second printing of the book)
line as currently set: below the constructor now uses the member initialization syntax for the initialization
corrected version: the constructor now uses the member initialization syntax for the initialization

Page 42:   Line 6 of the code
(fixed in the second printing of the book)
line as currently set:     void print() { cout << ``Name: '' << name << " Age: " << age; }
corrected version:     void print() { cout << "Name: " << name << " Age: " << age; }
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 43:   Line 4 from the bottom
(fixed in the second printing of the book)
line as currently set: and then if we invoke the print() function for uptr by
corrected version: and then if we invoke the print() function on this StudentUser object by
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 43:   Last line on the page
(fixed in the second printing of the book)
line as currently set:   Zaphlet 10 cosmology
corrected version:   Name: Zaphlet Age: 10 School Enrolled: cosmology
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 44:   Line 4 of the first complete paragraph
(fixed in the second printing of the book)
line as currently set: for a StudentUser object. No, not at all. As far as a StudentUser object is
corrected version: for a StudentUser object? No, not at all. As far as a StudentUser object is

Page 46:   Line 4 from the top
(fixed in the second printing of the book)
line as currently set: users[0] and users[1] and on the pointer users[1] after it is cast down to be of
corrected version: users[0] and users[2] and on the pointer users[1] after it is cast down to be of
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 53:  The function definition that starts in the code line labeled '//(C)' in the bottom third of the page
(fixed in the second printing of the book)
lines as currently set: friend ostream& operator<<(ostream& os, const User& user) {      //(C)
    os << "Name: " << user.name << " Age: " << user.age << endl;
}
corrected version: friend ostream& operator<<(ostream& os, const User& user) {      //(C)
    os << "Name: " << user.name << " Age: " << user.age << endl;
    return os;
}
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 56:  Fourth line from the top of the page
(fixed in the second printing of the book)
line as currently set: public class Test {
corrected version: class Test {
The above error was reported by Brian Ryall from purdue.edu.

Page 66:   Name of the program near the bottom of the page
(fixed in the second printing of the book)
line as currently set: //Namespaces.cc
corrected version: //Namespace4.cc

Page 72:   Source code line labeled //(B) in the bottom third of the page
(fixed in the second printing of the book)
line as currently set:     friend Y;
corrected version:     friend class Y;
The above error was reported by Mike Martin from purdue.edu.

Page 79:  Third line from the top of the page
(fixed in the second printing of the book)
line as currently set: Our discussion so far on object comparison has been centered primarily on a
corrected version: Our discussion so far on object comparison has centered primarily on a

Page 79:  Fifth line from the top of the page
(fixed in the second printing of the book)
line as currently set: values of one or more the data members of the objects. Java adds an additional twist
corrected version: values of one or more data members of the objects. Java adds an additional twist

Page 79:  First line of the third paragraph
(fixed in the second printing of the book)
line as currently set: In Java, comparison of two objects on the basis of equality of reference is carried
corrected version: In Java, a comparison of two objects on the basis of equality of reference is carried

Page 118:  The beginning section of the program Qsort.cc
(fixed in the second printing of the book)
lines as currently set:  #include <string>
 using namespace std;
corrected version:  #include <iostream>
 #include <string>
 using namespace std;

Page 119:   Code line labeled   //(B)   in the middle of the page
(fixed in the second printing of the book)
line as currently set:   string1.append( string2, 3, 6 );       //(B)
corrected version:   string1.append( string2, 4, 6 );       //(B)
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 121:   Program output shown and text at the top
(fixed in the second printing of the book)
lines as currently set:    4
   32
   one armadillo is like any other armadillo

where the numbers 4 and 32 are the position indices where the substring "hello"
occurs in the larger string "one hello is like any other hello".
Here is the program:
corrected version:    one armadillo is like any other armadillo

Here is the program:
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 121:  The beginning section of the program StringFind.cc
(fixed in the second printing of the book)
lines as currently set:  #include <string>
 using namespace std;
corrected version:  #include <iostream>
 #include <string>
 using namespace std;

Page 121:  Last line in the body of the while loop of the program StringFind.cc
(fixed in the second printing of the book)
line as currently set:    pos++;
corrected version:    pos += replaceString.size();
The above error was reported by Adam DePue from ecn.purdue.edu.

Page 122:   Last line of the first paragraph of Section 4.3.6
(fixed in the second printing of the book)
line as currently set: (B) is "Fiction has to make sense. - Tom Clancy"
corrected version: (A) is "Fiction has to make sense. - Tom Clancy"
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 125:  The beginning section of the program StringSize.cc
(fixed in the second printing of the book)
lines as currently set:  #include <iostream>
 #include <string>
corrected version:  #include <iostream>
 #include <string>
 using namespace std;

Page 127:  The beginning section of the program StringSizeOf.cc
(fixed in the second printing of the book)
lines as currently set:  #include <iostream>
 #include <string>
corrected version:  #include <iostream>
 #include <string>
 using namespace std;

Page 128:  The beginning section of the program ArraySizeOf.cc
(fixed in the second printing of the book)
lines as currently set:  #include <iostream>
corrected version:  #include <iostream>
 using namespace std;

Page 133:   Line 3 from the top
(fixed in the second printing of the book)
line as currently set: string. If we invoke the StringBuffer with an int argument, it constructs a string
corrected version: string. If we invoke the StringBuffer constructor with an int argument, it constructs a string

Page 133:   Line 4 from the top
(fixed in the second printing of the book)
line as currently set: buffer with no characters in, but a capacity as specified by the argument. So the
corrected version: buffer with no characters in it, but with a capacity as specified by the argument. So the

Page 137:  Source code for the StringSort.java program
(fixed in the second printing of the book)
line as currently set:      System.out.println("Case sensitive sort with Arrays.sort:" );
corrected version:      System.out.println("Case sensitive sort:" );
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 141:  The first line at the top of the page
(fixed in the second printing of the book)
line as currently set:     int n = str.lastIndxOf( "he" );     //7
corrected version:     int n = str.lastIndexOf( "he" );     //7
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 142:  Third line from the top
(fixed in the second printing of the book)
line as currently set: stands for the ending index of the desired substring. In all cases, for both String
corrected version: stands for the ending index of the desired substring plus one. In all cases, for both String

Page 142:   Code lines containing "56789" in the upper third of the page
(fixed in the second printing of the book)
lines as currently set: System.out.println( str.substring( 5, 9 ) );       // "56789"
System.out.println( stb.substring( 5, 9 ) );       // "56789"
corrected versions of these two lines: System.out.println( str.substring( 5, 9 ) );       // "5678"
System.out.println( stb.substring( 5, 9 ) );       // "5678"
The above error was reported by Vulinh Nguyen from j2eesoft.com.

Page 148:  First line at the top of the page
(fixed in the second printing of the book)
line as currently set: of linked lists come at a price. First, insertion of new elements and removal of existing
corrected version: of linked lists comes at a price. First, insertion of new elements and removal of existing

Page 157:   The line before the last line of the large middle paragraph
(fixed in the second printing of the book)
line as currently set: back() functions. Line (F) shows how a vector iterator can be initialized to point
corrected version: back() functions. Line (G) shows how a vector iterator can be initialized to point
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 157:  The beginning section of the program named VectorFrontBackResize.cc
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <vector>
corrected version: #include <iostream>
#include <vector>
using namespace std;

Page 158:  Indentation of the second code line from the top of the page
(fixed in the second printing of the book)
the first two lines as currently set:     while ( p != vec.end() ) result += *p++;
             return result;
corrected version:     while ( p != vec.end() ) result += *p++;
    return result;
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 160:  Line 7 from the top
(fixed in the second printing of the book)
line as currently set: insert. When we dereference the previously initialized iterator again in line (D), we
corrected version: insert. When we dereference the previously initialized iterator again in line (E), we
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 168:  The beginning section of the program DequeFront.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <deque>
#include <algorithm> // for sort, find
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <deque>
#include <algorithm> // for sort, find
using namespace std;

Page 169:   The line after the code line labeled "//(I)"
(fixed in the second printing of the book)
line as currently set:   print(animals);                // canray yak   
corrected version:   print(animals);                // canary yak   
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 171:  The beginning section of the program ListOps.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <list>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <list>
using namespace std;

Page 174:  The beginning section of the program StackOps.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <stack>
#include <vector>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <stack>
#include <vector>
using namespace std;

Page 175:  The beginning section of the program QueueOps.cc at the bottom of the page
(fixed in the second printing of the book)
lines as currently set: //QueueOps.cc

#include <string>
corrected version: //QueueOps.cc

#include <iostream>
#include <string>

Page 177:  The beginning section of the program PriorityQueueOps.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <queue>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <queue>
using namespace std;

Page 179:  The beginning section of the program MapHist.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <map>
#include <fstream>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <map>
#include <fstream>
using namespace std;

Page 181:  The beginning section of the program SetOps.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <set>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <set>
using namespace std;

Page 202:  The beginning section of the computer program named
VectorDest.cc in the bottom third of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <vector>
corrected version: #include <iostream>
#include <vector>
using namespace std;

Page 203:  The beginning section of the computer program named
VectorDestOrder.cc in the bottom fifth of the page
(fixed in the second printing of the book)
line as currently set: #include <iostream>
#include <vector>
corrected version: #include <iostream>
#include <vector>
using namespace std;

Page 204:  The beginning section of the computer program
for Problem 4 in the bottom half of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <vector>
corrected version: #include <iostream>
#include <vector>
using namespace std;

Page 208:   footnote
(fixed in the second printing of the book)
footnote number as currently displayed: 2324
corrected version: 23

Page 232:   The beginning section of the program ExplicitCast1.cc
(fixed in the second printing of the book)
line as currently set:  #include <iostream.h>
 using namespace std;
corrected version:  #include <iostream>
 using namespace std;

Page 233:  The beginning section of the program ExplicitCast2.cc
(fixed in the second printing of the book)
line as currently set:  #include <iostream>
corrected version:  #include <iostream>
 using namespace std;

Page 233:  Last line on the page
(fixed in the second printing of the book)
line as currently set:     1000000 00000000
corrected version:     10000000 00000000
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 240:  The beginning section of the program TestFilePosition.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 #include <string>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 #include <string>
 using namespace std;

Page 241:  The beginning section of the program TestFilePosition2.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 #include <string>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 #include <string>
 using namespace std;

Page 243:  Lines 5 and 6 from the bottom of the page
(fixed in the second printing of the book)
lines as currently set: fail() returns true when either bad() returns true or when eof() evaluates
to false
. Finally, the function good() returns true as long as the stream has
corrected version: fail() returns true when either bad() returns true or because the requested
operation has failed for formatting reasons (as, for example, when a letter is
encountered while trying to read an integer)
. Finally, the function good()
returns true as long as the stream has
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 245:  The beginning section of the program GetThirdType.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 using namespace std;

Page 245:  Lines 5 and 6 from the bottom of the page
lines as currently set: The additional functions introduced here, getline, gcount(), and ignore(),
all return the istream object on which they are invoked.
corrected version: Of the additional functions introduced here, getline() and ignore() return the istream
object on which they are invoked, and gcount() returns the number of bytes just read.
The above error was reported by Olakunle Lawani from hotmail.com

Page 247:  The beginning section of the program BinaryFileIO.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 #include <cstdlib>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 #include <cstdlib>
 using namespace std;

Page 248:  The beginning section of the program BinaryFileIO2.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 #include <cstdlib>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 #include <cstdlib>
 using namespace std;

Page 250:  The beginning section of the program WriteBinaryIntsToFile.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 using namespace std;

Page 250:  Line labeled //(B) in the program WriteBinaryIntsToFile.cc
(fixed in the second printing of the book)
lines as currently set:       out.write( data, sizeof( data ) );
corrected version:       out.write( (char*) data, sizeof( data ) );

Page 250:  Line that begins with the word 'array' in the bottom third of the page
line as currently set: array, the next four bytes of the next integer, and so on. However, if run the same
corrected version: array, the next four bytes of the next integer, and so on. However, if we run the same

Page 251:  The beginning section of the program BinaryFileIO3.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 using namespace std;

Page 251:  Line labeled //(C) in the program BinaryFileIO3.cc
(fixed in the second printing of the book)
lines as currently set:       out.write( data, sizeof( data ) );
corrected version:       out.write( (char*) data, sizeof( data ) );
The above error was reported by Paul La Tour from ecn.purdue.edu.

Page 251:  Line labeled //(I) in the program BinaryFileIO3.cc
(fixed in the second printing of the book)
lines as currently set:       in.read( buffer, size );
corrected version:       in.read( (char*) buffer, size );
The above error was reported by Paul La Tour from ecn.purdue.edu.

Page 256:  The beginning section of the program Skipws.cc
(fixed in the second printing of the book)
lines as currently set:  #include <fstream>
 using namespace std;
corrected version:  #include <iostream>
 #include <fstream>
 using namespace std;

Page 257:   Second line of the last code example near the bottom of the page
(fixed in the second printing of the book)
line as currently set:   ofstream from( "textfile" );
corrected version:   ifstream from( "textfile" );
The above error was reported by Shawn Jordan from ecn.purdue.edu.

Page 262:   Botched-up line (second line of text)
(fixed in the second printing of the book)
line as currently set: unreadable because of overprinting
corrected version: of each file in hex, and what the output looks like if read in text mode. The program starts out by declaring and initializing the int in line (A). Our first

Page 279:   Line 9 of Homework Problem 10
(fixed in the second printing of the book)

Replace    object serialization    by    object deserialization   

(Note that this correction is for the  second occurrence of object serialization in that paragraph.)

Page 293:  Line 5 from the top of the page
(fixed in the second printing of the book)
line as currently set:       const n = 100;           // WRONG
corrected version:       const int n = 100;       // WRONG

Page 297:   First line of the last paragraph
(fixed in the second printing of the book)
line as currently set: Pointers and, as we will be discussed in the next section, arrays of pointers play
corrected version: Pointers and, as will be discussed in the next section, arrays of pointers play

Page 299: Line labeled   //(C)   in the middle of the page
(fixed in the second printing of the book)
line as currently set:    Person peson1( "John Doe", "Main Street USA" );            //(C)
corrected version:    Person person1( "John Doe", "Main Street USA" );           //(C)
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 302:  Line 10 from the bottom of the page
(fixed in the second printing of the book)
line as currently set:     int x, y, v[10];      in C++ or Java
corrected version:     int x, y, v[10];      in C++
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 307:  The second text line after the last code line on the page
(fixed in the second printing of the book)
line as currently set: entity as long it is of the same type, an array name cannot be made to point to some
corrected version: entity as long as it is of the same type, an array name cannot be made to point to some
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 312:  Line 3 of the paragraph that begins with "On the other hand,"
(fixed in the second printing of the book)
line as currently set: character (\u000) for arrays for chars, to 0.0f for floating point arrays, to 0.0 for
corrected version: character (\u000) for arrays of chars, to 0.0f for floating point arrays, to 0.0 for

Page 313:  The second line from the top of the page
(fixed in the second printing of the book)
line as currently set: objects is first created in Java, each element is default-initialized to a hold the null
corrected version: objects is first created in Java, each element is default-initialized to hold the null
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 315:  Sixth line from the top of the page
(fixed in the second printing of the book)
line as currently set: cessing. The methods provided can be divided into the following four categories:
corrected version: cessing. The methods provided can be divided into the following three categories:

Page 315:  Line 8 of the paragraph that begins with the header "sort methods:" in the bottom half of the page
(fixed in the second printing of the book)
line as currently set: class-type objects is whether the object that are deemed to be equal according
corrected version: class-type objects is whether the objects that are deemed to be equal according

Page 321:  The second text line in the second paragraph after the code
(fixed in the second printing of the book)
line as currently set: error since the symbolic constant light in not in scope in main(). As we mentioned
corrected version: error since the symbolic constant light is not in scope in main(). As we mentioned
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 321:   First line of the next to the last paragraph
(fixed in the second printing of the book)
line as currently set: On the other hand, the statements in lines (J) and (L) that involve the symbolic
corrected version: On the other hand, the statements in lines (J) and (M) that involve the symbolic

Page 321:   Second line of the next to the last paragraph
(fixed in the second printing of the book)
line as currently set: constants c1 and h are legal since these symbolic constants were introduced through
corrected version: constants c1 and tall are legal since these symbolic constants were introduced through

Page 323:  The beginning section of the program EnumWithLabelArray.cc
(fixed in the second printing of the book)
line as currently set: #include <string>
corrected version: #include <string>
#include <iostream>
using namespace std;
The above error was reported by Brian Ryall from purdue.edu.

Page 324:  Just above the long horizontal straight line in the middle of the page
(fixed in the second printing of the book)
line as currently set:     retrun 0;
corrected version:     return 0;
The above error was reported by Brian Ryall from purdue.edu.

Page 325:  Statement of Homework Problem 5 near the bottom of the page
(fixed in the second printing of the book)
line as currently set: Will C++ this program compile and execute?
corrected version: Will this C++ program compile and execute?
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 335:    Line labeled  //(A)   in the middle of the page
(fixed in the second printing of the book)
line as currently set:     User u = new User( ` `Zygot' ', 38  );            //(A)
corrected version:     User u = new User( "Zygot", 38  );               //(A)
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 343:  The header of the for loop
(fixed in the second printing of the book)
line as currently set:     for ( int i = 0; i < 3 * wideth * height; i++ )
corrected version:     for ( int i = 0; i < 3 * width * height; i++ )
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 346:   Line 2 of footnote 1 near the bottom of the page.
(fixed in the second printing of the book)
line as currently set:   in Chapter 7.
corrected version:   in Chapter 6.

Page 359:  First line at the top of the page
(fixed in the second printing of the book)
line as currently set: object y in main going to be the same as what was the local object usr inside f or a
corrected version: object supplied as the initializer to y in main going to be the same as what was the local object usr inside f or a

Page 364:  Last line of the third paragraph
(fixed in the second printing of the book)
line as currently set: following will code fragment is wrong:
corrected version: following code fragment is wrong:
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 371:   The program output line after the code example in the middle of the page.
(fixed in the second printing of the book)
line as currently set:     from g(double): x is 1
corrected version:     g(double): x is 1
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 372:  Line 9 from the top of the page
(fixed in the second printing of the book)
line as currently set: for overload resolution in Java. There are reproduced here from [2].
corrected version: for overload resolution in Java. These are reproduced here from [2].
The above error was reported by David Irimies from purdue.edu.

Page 376:  The beginning section of the program Silly.cc in the middle of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <string>
corrected version: #include <iostream>
#include <string>
using namespace std;
The above error was reported by Brian Ryall from purdue.edu.

Page 382:  Second line of Homework Problem 8
line as currently set: Overload.java of Section 9.12. In the program of Section 9.12, the first call to
corrected version: Overload.java of Section 9.11. In the program of Section 9.11, the first call to

Page 397:  The beginning section of the program ExceptionUsage7.cc in
the upper third of the page
(fixed in the second printing of the book)
line as currently set: #include <iostream>
corrected version: #include <iostream>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Page 397:  The beginning section of the program ExceptionUsage8.cc in
the bottom third of the page
(fixed in the second printing of the book)
line as currently set: #include <iostream>
corrected version: #include <iostream>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Page 398:  The beginning section of the program ExceptionUsage9.cc in
the middle third of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <string>
corrected version: #include <iostream>
#include <string>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Page 399:   First line of item 2 in the middle of the page
(fixed in the second printing of the book)
line as currently set: If a function is written so as to throw an exception, that fact must be declared
corrected version: If a Java function is written so as to throw an exception, that fact must be declared

Page 399:   Last line of item 2
(fixed in the second printing of the book)
line as currently set: new for constructing an object of type MyException.
corrected version: new for constructing an object of type MyException. It is not mandatory in C++
to include a function's exception specification in the header of the function.

Page 399:   First line of item 3 near the bottom of the page
(fixed in the second printing of the book)
line as currently set: An exception-throwing function can only be invoked in one of the following
corrected version: An exception-throwing function in Java can only be invoked in one of the following

Page 400:  Third line of item 4 in the upper third of the page
(fixed in the second printing of the book)
line as currently set: words, one now has no choice but to say
corrected version: words, in Java one has no choice but to say

Page 410:  Line that begins with "to be used for a new Java class ...." above the middle of the page
line as currently set: to be used for a new Java class, FileIO with the static methods listed below.
corrected version: to be used for a new Java class FileIO with the static methods listed below.

Page 410:   Second line of the code block in the lower half of the page
line as currently set:          throws File IOException
corrected version:          throws FileIOException

Page 419:  The beginning section of the program NoArgMissing.cc near
the top of the page
(fixed in the second printing of the book)
line as currently set: #include <vector>
corrected version: #include <vector>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Page 427:  Third line from the top of the page
(fixed in the second printing of the book)
line as currently set:    Finally, note that in line (C) the data member today is of the same type as the class
corrected version:    Finally, note that in line (A) the data member today is of the same type as the class

Page 443:   The three lines of program output shown in the bottom half of the page.
(fixed in the second printing of the book)
code lines as currently set:    GameScore object destroyed 35 vs. 7
   GameScore object destroyed 28 vs. 3
   GameScore object destroyed 29 vs. 0
corrected version:    GameScore object destroyed 29 vs. 0
   GameScore object destroyed 35 vs. 7
   GameScore object destroyed 28 vs. 3
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 478:  Line 14 from the top of the page
(fixed in the second printing of the book)
line as currently set:       cout << *p++  <<  "   ";
corrected version:       os   << *p++  <<  "   ";
The above error was reported by Jenson Yan from ecn.purdue.edu.

Page 478:  Line 21 from the top of the page
(fixed in the second printing of the book)
line as currently set:       cout << q→first << ": " << q→second << "   ";
corrected version:       os   << q→first << ": " << q→second << "   ";
The above error was reported by Jenson Yan from ecn.purdue.edu.

Page 505:  Source code line that starts with friend in the middle of the page
(fixed in the second printing of the book)
line as currently set:    friend ostream& operator<< (  ostream&, MyComplex& );
corrected version:    friend ostream& operator<< (  ostream&, const MyComplex& );
The above error was reported by Brian Ryall from purdue.edu.

Page 511:  The code line immediately after the line labeled    //(A)
(fixed in the second printing of the book)
line as currently set:     return ( i >= 0 && i <= length ) ? true: false;
corrected version:     return ( i >= 0 && i <= length && length != 0 ) ? true: false;
The above error was reported by Jason Molenda from ecn.purdue.edu.

Page 514:  Overloading of the input operator near the top of the page
lines as currently set:     istream& operator>> ( istream& is, MyString& str ) {
        char* ptr = new char[100];                           //(A)
        is >> ptr;                                           //(B)
        str = MyString( ptr );                               //(C)
        delete ptr;
        return is;
    }
corrected version:     istream& operator>> ( istream& is, MyString& str ) {
        char* ptr = new char[100];                           //(A)
        is >> ptr;                                           //(B)
        str = MyString( ptr );                               //(C)
        delete[] ptr;
        return is;
    }
The above error was reported by Olakunle Lawani from hotmail.com

Page 515:  Definition of constructor in lines 3 through 7 from the top of the page
lines as currently set:     MyString( const char* ch ) {
        lengh = strlen( ch );
        charArr = new char[ length + 1];
        strcpy( charArr, ch );
    }
corrected version:     MyString( const char* ch ) {
        lengh = strlen( ch );
        if ( length == 0 ) { charArr = 0; return; }
        charArr = new char[ length + 1];
        strcpy( charArr, ch );
    }

Page 515:  Definition of copy constructor in lines 15 through 19 from the top of the page
lines as currently set:     MyString( const MyString& str ) {
        lengh = str.length;
        charArr = new char[ length + 1];
        strcpy( charArr, str.charArr );
    }
corrected version:     MyString( const MyString& str ) {
        lengh = str.length;
        if ( length == 0 ) return;
        charArr = new char[ length + 1];
        strcpy( charArr, str.charArr );
    }

Page 517:  Overloading of the output operator
lines as currently set:     ostream& operator<< ( ostream& os, const MyString& str ) {
        os << str.charArr;
        return os;
    }
corrected version:     ostream& operator<< ( ostream& os, const MyString& str ) {
        if ( str.charArr == 0 ) return os;
        os << str.charArr;
        return os;
    }

Page 517:  Overloading of the input operator
lines as currently set:     istream& operator>> ( istream& is, MyString& str ) {
        char* ptr = new char[100];
        is >> ptr;
        str = MyString( ptr );
        delete ptr;
        return is;
    }
corrected version:     istream& operator>> ( istream& is, MyString& str ) {
        char* ptr = new char[100];
        is >> ptr;
        str = MyString( ptr );
        delete[] ptr;
        return is;
    }
The above error was reported by Olakunle Lawani from hotmail.com

Page 525:  Line 7 from the bottom of the page
(fixed in the second printing of the book)
line as currently set:     SmartPtr operator=( SmartPtr& other ) {
corrected version:     SmartPtr& operator=( SmartPtr& other ) {
The above error was reported by Hosung Hwang from yahoo.com

Page 526:  Code line labeled    //(A)
(fixed in the second printing of the book)
line as currently set:     explicit SmartPtr( X* p = 0 ) : ptr( p ) {};
corrected version:     explicit SmartPtr( X* p = 0 ) : ptr( p ) {}
The above error was reported by Peter Richmond from ecn.purdue.edu.

Page 526:  Line 10 from the top of the page
(fixed in the second printing of the book)
line as currently set:     SmartPtr operator=( SmartPtr& other ) {
corrected version:     SmartPtr& operator=( SmartPtr& other ) {
The above error was reported by Hosung Hwang from yahoo.com

Page 527:  The first line of the assignment operator overload definition in the middle of the page
(fixed in the second printing of the book)
line as currently set:     SmartPtr operator=( SmartPtr<T>& other ) {
corrected version:     SmartPtr& operator=( SmartPtr<T>& other ) {
The above error was reported by Hosung Hwang from yahoo.com

Page 534:  Line 2 of the second complete paragraph
line as currently set: code below, the former for designated a point in 3D xyz space, and the latter a point in
corrected version: code below, the former for designating a point in 3D xyz space, and the latter a point in
The above error was reported by Olakunle Lawani from hotmail.com

Page 536:   Seventh line from the top of the page
(fixed in the second printing of the book)
line as currently set:    friend Point3D;
corrected version:    friend class Point3D;
The above error was reported by Mike Martin from purdue.edu.

Page 537:   Line 11 from the top of the page
(fixed in the second printing of the book)
line as currently set:    friend Point3D;
corrected version:    friend class Point3D;
The above error was reported by Mike Martin from purdue.edu.

Page 538:   Line 2 of the footnote
(fixed in the second printing of the book)
line as currently set: ThresholdCheck defined in Problem 4 of the homework section of Chapter 5.
corrected version: ThresholdCheck defined in Problem 6 of the homework section of Chapter 5.

Page 539:  The beginning section of the program SortWithFunctor.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <list>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <list>
using namespace std;
Click here to see a better implementation of SortWithFunctor.cc

What is ugly about the implementation shown in the first printing of the
book is that the templatized print function accesses the data members of the
Cat class. The second printing of the book includes the improved version.

Page 540:  The first line after the code line labeled //(B)
(fixed in the second printing of the book)
line as currently set:     print( kittyList );        // cuddles 3 socks 6 tabby 6
corrected version:     print( kittyList );        // cuddles 3 socks 6 tabby 8
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 540:  Ninth line from the top of the page
(fixed in the second printing of the book)
line as currently set:    typedef list<T>::const_iterator CI;
corrected version:    typedef typename list<T>::const_iterator CI;

Page 541:  The beginning section of the program SortWithLessThan.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <list>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <list>
using namespace std;
Click here to see a better implementation of SortWithLessThan.cc

What is ugly about the implementation shown in the first printing of the
book is that the templatized print function accesses the data members of the
Cat class. The second printing of the book includes the improved version.

Page 541:  Sixth line from the bottom of the page
(fixed in the second printing of the book)
line as currently set:    typedef list<T>::const_iterator CI;
corrected version:    typedef typename list<T>::const_iterator CI;

Page 542:  The beginning section of the program SortPointerTypes.cc
(fixed in the second printing of the book)
lines as currently set: #include <string>
#include <vector>
#include <algorithm>
using namespace std;
corrected version: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
Click here to see a better implementation of SortPointerTypes.cc

What is ugly about the implementation shown in the first printing of the
book is that the templatized print function accesses the data members of the
Cat class. The second printing of the book includes the improved version.

Page 543:  Code line in the middle of the page
(fixed in the second printing of the book)
line as currently set:    typedef vector<T>::const_iterator CI;
corrected version:    typedef typename vector<T>::const_iterator CI;

Page 558:  The third, the fourth, and the fifth lines from the bottom of the page
(fixed in the second printing of the book)
lines as currently set: friend ostream& operator<<( ostream& os, const X& xobj  ) {
    os << xobj.n << " ";
}
corrected version: friend ostream& operator<<( ostream& os, const X& xobj  ) {
    os << xobj.n << " ";
    return os;
}
The above error was reported by Kevin Murphy from ecn.purdue.edu.

Page 561:  The beginning section of the program LinkedListSpecialized.cc
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include "LinkedListGeneric.h"   // This is the same as the program
                                 // LinkedListGeneric.cc but without
                                 // its main()

class LinkedList<char*> {                                     //(A)
corrected version: #include <iostream>
#include "LinkedListGeneric.h"   // This is the same as the program
                                 // LinkedListGeneric.cc but without
                                 // its main()
using namespace std;

template<>
class LinkedList<char*> {                          //(A)

Page 563:  Lines 2, 3, and 4 from the top of the page
(fixed in the second printing of the book)
lines as currently set: template <class T> is now missing from the header of the class definition. How-
ever, if we so wanted, we could have used the prefix template <> and defined the
specialization as
corrected version: template <class T> is now replaced by template <> in the explicit specialization.
Therefore when the compiler sees the following

Page 563:  Eighth line from the top of the page
(fixed in the second printing of the book)
line as currently set: Although we do not need the prefix any more, the compiler knows that this specializa-
corrected version: it knows that this specializa-

Page 563:  First line of the third paragraph
(fixed in the second printing of the book)
line as currently set:   For the same reason we did not need the prefix template<class T> for the class
corrected version:   Unlike the prefix template<> for the class

Page 565:  Fourth line from the top of the page
(fixed in the second printing of the book)
line as currently set:     Buffer<> buf1;       // a string buffer of size 128
corrected version:     Buffer<> buff1;      // a string buffer of size 128
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 601:  Fourth line from the bottom of the page
(fixed in the second printing of the book)
line as currently set: of which is responsible for a locating a particular landmark from a list of landmarks
corrected version: of which is responsible for locating a particular landmark from a list of landmarks

Page 647:  The beginning section of the program StaticBinding.cc in
the top third of the page
(fixed in the second printing of the book)
line as currently set: //StaticBinding.cc
corrected version: //StaticBinding.cc

#include <string>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Page 648:  Line 6 from the bottom of the page
(fixed in the second printing of the book)
line as currently set:       virtual f5();
corrected version:       virtual void f5();
The above error was reported by Cheolsoon Im from ecn.purdue.edu.

Page 724:  Line 15 from the top of the page
(fixed in the second printing of the book)
line as currently set:       Assemble( Part1* p1, Part* p2,
corrected version:       Assemble( Part* p1, Part* p2,
The above error was reported by John Mastarone from ecn.purdue.edu

Page 724:  Fifth line from the bottom of the page
(fixed in the second printing of the book)
line as currently set:       AssembleWithRobot( Part1* p1, Part* p2,
corrected version:       AssembleWithRobot( Part* p1, Part* p2,
The above error was reported by John Mastarone from ecn.purdue.edu

Page 726:  Line 10 from the top of the page
(fixed in the second printing of the book)
line as currently set:       Assemble( Part1* p1, Part* p2,
corrected version:       Assemble( Part* p1, Part* p2,
The above error was reported by John Mastarone from ecn.purdue.edu

Page 727:  Fifth line from the bottom of the page
(fixed in the second printing of the book)
line as currently set:       AssembleWithRobot( Part1* p1, Part* p2,
corrected version:       AssembleWithRobot( Part* p1, Part* p2,
The above error was reported by John Mastarone from ecn.purdue.edu

Page 736:  Third line from the top of the page
(fixed in the second printing of the book)
line as currently set: is it to create the the shared X subobject? The answer to this question is supplied by
corrected version: is it to create the shared X subobject? The answer to this question is supplied by

Page 736:  Lines 13, 15, and 23 from the top of the page
(fixed in the second printing of the book)
Replace the three occurrences of the symbol uppercase W by the symbol uppercase Z.
The above error was reported by Bill Dwyer from ecn.purdue.edu.

Page 744:  The beginning section of the program DuplicateBase.cc near
the top of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream.h>
using namespace std;
corrected version: #include <iostream>
using namespace std;

Page 776:  Insert a new one-line function definition in the bottom half of the page
(fixed in the second printing of the book)
lines as currently set:     }
    void print() {
corrected version:     }
    bool computeEmployeeSatisfaction() { return true; }
    void print() {
The above error was reported by Jason Owen from ecn.purdue.edu.

Page 860:   Line 3 of the code example
(fixed in the second printing of the book)
line as currently set: //inconsequential made by the author
corrected version: //inconsequential changes made by the author

Page 890:  In the top one-third of the page
(fixed in the second printing of the book)
lines as currently set: #include "WindowWithMenu.h"
#include <qfiledialog>
#include <iostream>
corrected version: #include "WindowWithMenu.h"
#include <qfiledialog>
#include <iostream>
using namespace std;
The above error was reported by Philip Vorsilak from purdue.edu.

Page 912:  Fourth line from the bottom of the page
line as currently set:         if ( g2d == null ) g2d = (Graphics2D) g;
corrected version:         g2d = (Graphics2D) g;
The above error was reported by John Mastarone from ecn.purdue.edu.

Page 932:  Second line of the second paragraph
(fixed in the second printing of the book)
line as currently set:  GDK_BUTTON_PRESS and GTK_2BUTTON_PRESS since, like in the earlier Qt program,
corrected version:  GDK_BUTTON_PRESS and GDK_2BUTTON_PRESS since, like in the earlier Qt program,
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 934:  Indentation of the seventh line from the bottom of the page
(fixed in the second printing of the book)
The sixth, seventh, and the eighth
lines from the bottom of the page
as currently set:
        }
           return(TRUE);
     }
corrected version:         }
        return(TRUE);
     }
The above error was reported by Xubo from mail.nbptt.zj.com

Page 938:   Line 3 of the first paragraph
(fixed in the second printing of the book)
line as currently set: with a number of attributes, some of which are mandatory and other optional, the
corrected version: with a number of attributes, some of which are mandatory and others optional; the

Page 941:  Lines 8 and 9 from the bottom of the page
(fixed in the second printing of the book)
line as currently set: is carried out by the loadImages method, defined in the program at line (O). Note
how this method is run in a separate thread in init in line (M):
corrected version: is carried out by the loadImages method, defined in the program at line (L). Note
how this method is run in a separate thread in init in line (J):
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 942:  Fourth line from the top of the page
(fixed in the second printing of the book)
line as currently set: ages, as opposed to the Image class. As was mentioned earlier in Section 17.9, the
corrected version: ages, as opposed to the Image class. As was mentioned earlier in Section 17.19, the
The above error was reported by Xubo from mail.nbptt.zj.cn

Page 947:   The blank line after line 4 of the HTML code at the top of the page
(fixed in the second printing of the book)
line as currently set: blank line
corrected version: </head>
The above error was reported by Bryan Kennedy from statefarm.com.

Page 955:  Indentation of the sixth line from the bottom of the page
(fixed in the second printing of the book)
The Fifth, sixth, and the seventh
lines from the bottom of the page
as currently set:
        }
     i++;
     }
corrected version:         }
        i++;
     }
The above error was reported by Xubo from mail.nbptt.zj.com

Page 970:  Sixth bulleted item in the middle of the page
(fixed in the second printing of the book)
line as currently set:     •  blocked
corrected version:     •  blocking

Page 973
(fixed in the second printing of the book)
Delete the implementation of the keepBusy() function for the class RepeatedSwaps. Please do NOT delete this function at the top of the page. It is the repeat definition of this function in the middle of the page that is unnecessary.

Page 975:  Line 13 from the top
(fixed in the second printing of the book)
line as currently set: result moved back to dataItem1 will not correspond to thread1 but to thread2.
corrected version: result moved back to dataItem2 will not correspond to thread1 but to thread2.

Page 990:  Second line of the first paragraph of Section 18.8
(fixed in the second printing of the book)
line as currently set: is to construct an applet that loads in a sequence of images sufficiently rapidly so that
corrected version: is to construct an applet that displays a sequence of images sufficiently rapidly so that

Page 990:  Third line of the second paragraph of Section 18.8
(fixed in the second printing of the book)
line as currently set: ecutive shots of a bird in flight. We wish to create a thread that would load and
corrected version: ecutive shots of a bird in flight. We wish to create a thread that would

Page 1002:  Fourth line from the top of the page
(fixed in the second printing of the book)
line as currently set: suppose to alter the state of the GUI after finishing some time-consuming operation,
corrected version: supposed to alter the state of the GUI after finishing some time-consuming operation,

Page 1002:  First line of the new paragraph in the middle of the page
(fixed in the second printing of the book)
line as currently set:   The main library for POSIX threads in C is pthreads.h. It defines a data type
corrected version:   The main header file for POSIX threads in C is pthreads.h. It defines a data type

Page 1027:  Second line of the first paragraph
(fixed in the second printing of the book)
line as currently set: in the client-server model. Today it is probably the most commonly used model
corrected version: on the client-server model. Today it is probably the most commonly used model

Pages 1029-1030:  Source code for the ClientSocket.java program


Click here to see a better implementation of ClientSocket.java


The GET request as shown in the book works only under the ancient 0.9 version of HTTP.
For HTTP 1.0 and 1.1, a GET request consists of multiple lines that look like:

GET pathname_to_resource HTTP 1.x
header1: value1
header2: value2
.....
blank-line

HTTP 1.0 defines 16 headers, all optional. HTTP 1.1 defines 46 headers, with just the Host:
header mandatory. Each line of a multiline request must end in CRLF, a two-character sequence
consisting of "carriage return" followed by "linefeed".

Page 1040:  The beginning section of the program ClientSocket.h in the
lower half of the page
(fixed in the second printing of the book)
lines as currently set: #include <qsocket.h>
#include <string>
corrected version: #include <qsocket.h>
#include <string>
using namespace std;
The above error was reported by Mike Martin from purdue.edu.

Pages 1041-1043:  Source code for the ClientSocket.cc program


Click here to see a better implementation of ClientSocket.cc


The GET request as shown in the book works only under the ancient 0.9 version of HTTP.
For HTTP 1.0 and 1.1, a GET request consists of multiple lines that look like:

GET pathname_to_resource HTTP 1.x
header1: value1
header2: value2
.....
blank-line

HTTP 1.0 defines 16 headers, all optional. HTTP 1.1 defines 46 headers, with just the Host:
header mandatory. Each line of a multiline request must end in CRLF, a two-character sequence
consisting of "carriage return" followed by "linefeed".

Page 1049:  Missing return statement after the fourth line from the bottom of the page
(fixed in the second printing of the book)
fourth and fifth lines from the bottom of the page as currently set:        chatServer = other.chatServer;
    }
corrected version:        chatServer = other.chatServer;
       return *this;
    }
The above error was reported by Shawn Jordan from ecn.purdue.edu.

Page 1058:  Fifth line of the fourth paragraph
(fixed in the second printing of the book)
line as currently set: database. A commonly used driver by Java programs is the open-sourceMM.MySQL
corrected version: database. A commonly used driver by Java programs is the open-source MM.MySQL

Page 1059:   First line of the third paragraph
(fixed in the second printing of the book)
line as currently set: A driver manager can also help establish a connection with a database. Using the
corrected version: A driver manager can also help establish a connection with a database. Using for

Page 1064:   Second line of the text just above the last table
(fixed in the second printing of the book)
line as currently set: more (now shown), MySQL will respond to the SELECT command by returning the
corrected version: more (not shown), MySQL will respond to the SELECT command by returning the

Page 1077:  The beginning section of the program DBFriends1.cc in the
lower third of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <sqlplus.hh>
#include <iomanip>
corrected version: #include <iostream>
#include <sqlplus.hh>
#include <iomanip>
using namespace std;
The above error was reported by Brian Ryall from purdue.edu.

Page 1079:  The beginning section of the program DBFriends2.cc in the
lower third of the page
(fixed in the second printing of the book)
lines as currently set: #include <iostream>
#include <sqlplus.hh>
#include <iomanip>
corrected version: #include <iostream>
#include <sqlplus.hh>
#include <iomanip>
using namespace std;
The above error was reported by Brian Ryall from purdue.edu.

Page 1085:  Citation for reference 33
(fixed in the second printing of the book)
line as currently set: http://java.sun.com/j2se/1.3/docs/index.html. Java 2 SDK, Standard Editor Doc-
corrected version: http://java.sun.com/j2se/1.3/docs/index.html. Java 2 SDK, Standard Edition Doc-

Page 1110:   Last entry in the left column
(fixed in the second printing of the book)
line as currently set: sizeof, 6-7, 98, 117, 125
corrected version: sizeof, 6-7, 99, 117, 125-128



Back to the home page for Programming with Objects