static keyword, 642-643, 653
static member data, 506-508
accessing, 692
nonstatic methods,
510-511
without objects,
508-509
declaring in templates,
689-692
defining, 507
example, 506-507
initializing, 692
static member functions
accessing, 513
advantages, 534
calling, 511-513
sample listing, 512
static model, 354
std namespaces, 654-655
STL (Standard Template
Library), 693
algorithms
function objects,
708-709
mutating sequence
operations, 710-711
nonmutating sequence
operations, 709-710
deque containers, 703
list containers, 701-702
map containers, 704-707
multimap containers, 708
multiset containers, 708
queues, 703
set containers, 708
stacks, 702-703
vector containers
adding elements to,
695
creating, 694
defined, 694
empty vectors, 695
sample program listing,
696-700
“stomping” on pointers, 247
stop conditions, 124-125
storing
arrays
on free store, 421-423
on stack, 421
memory addresses in
pointers, 224-225
stray pointers, 245-248
cautions, 247
compared to null pointers,
248
creating, 246-247
strcpy( ) function, 435
streambuf class, 597
streams, 593-594
buffers, 594-596
flushing, 596
implementing, 597
compared to printf( )
function, 620-622
encapsulation, 594
ofstream class, 624
condition states, 624
default behavior,
626-628
opening files, 624-626
redirection, 598
standard I/O objects,
597-598
cerr, 598
cin, 598-612
clog, 598
cout, 598, 613-620
String classes, 436-441,
538-542, 545
constructors, 441
declaring, 437-443
destructor, 442
operators
implement, 442
offset, 442-443
overloaded operators,
441
strings
concatenating, 759-760
copying, 435-436
current values, printing,
769-771
defined, 28
null character, 601
parsing, 423, 425
placing in quotes, 759
String classes, 436-441,
538-542, 545
constructors, 441
declaring, 437-443
destructor, 442
operators, 441-443
stringizing, 759
substitutions, 752
testing, 753-754
strncpy( ) function, 435-436
strong typing, 159
Stroustrup, Bjarne, 11
struct keyword, 171
structured programming,
8-9
structures, 138, 171-173
style guidelines (code)
access labels, 783
assert( ) macro, 784
braces, 779
capitalization, 782
class definitions, 783
comments, 782-783
const statement, 784
identifier names, 781-782
include files, 784
indents, 779-780
long lines, 780
readability of code,
780-781
spelling, 782
subclasses, 166-171
subtracting pointers,
423-426
subtraction operator (-),
71-72
supersets, 372
swap( ) function, 110
pointers, 264-265
references, 265-267
switch statement
case values, 199
example, 199-200
908 static keyword
34 0672327112 index.qxd 11/19/04 12:31 PM Page 908