Sams Teach Yourself C++ in 21 Days

(singke) #1
methods
accessor methods,
147-148
GetAge( ), 153
GetWeight( ), 164
implementing, 151-152
Meow( ), 148, 153
SetAge( ), 153
Cat object, initializing,
156-157
Cat.cpp, 165
Cat.hpp, 164
catch blocks, 719, 729-732
catching exceptions,
728-732
Celsius, converting to
Fahrenheit, 106
cerr object, 598, 635
char arrays, 432-434
char variables, 43, 46
character encoding, 57
escape characters, 58-59
sizes, 56
character reference
parameters (get( )
method), 606
characters, 56-57
ASCII character sets, 46
character strings,
parsing, 423-425
encoding, 57
escape characters, 58-59
fill characters, 616-617
null, 432, 601
sizes, 56
cin object, 598-600
input
extraction operator,
603-604
multiple input,
601-603
strings, 600-601
methods
get( ), 604-608
getline( ), 608-610
ignore( ), 610-611

peek( ), 611-612
putback( ), 611-612
class keyword, 141,
149-151, 662
class, responsibility, and
collaboration cards.
SeeCRC cards
classes, 150. See also
specific class names
abstract, 486
array classes, 444-445,
663
base classes, 372
compared to objects, 142
compared to structures,
171
contained classes, 537
accessing members of,
545
compared to
delegation, 553-561
constructors, 546-549
costs, 546-549
Employee class,
542-544
filtering access to, 545
implementing,
552-553
passing by value,
549-552
String class, 538-542
data members, 140
accessing, 143-146
other classes as,
166-171
private, 144-145, 172,
376-377
protected, 376-377
public, 144-146
declaring, 141, 159-163,
374-376, 783
defined, 140
derived classes, 372-376,
473, 476-477
friend classes, 571-572
declaring, 580
sample program
listing, 572-579
usage tips, 579

inheritance
casting down,
453-455, 487
limitations, 449-452
percolating shared
functions, 452
invariants, 764-769
methods, 140
constants, 158-159
default values, 292-294
defining, 143-144
implementing, 151-154
inline, 163-166
overloading, 289-294
public accessor
methods, 147-148
mixins, 473
naming conventions,
141-142
object-oriented design,
350
CRC cards, 354-357
data manipulation, 353
device protocols, 354
dynamic model,
363-366
preliminary classes,
351-352
relationships, 358-363
static model, 354
transformations,
352-353
views, 353
polymorphism, 11
resolving by name,
638-642
security, 148-149
shared base classes,
464-468
subclasses, 166-171
writing to files, 629-631
clearing bits, 774-775
clients, 159
clog object, 598, 635
code
code rot, 746
code space, 130
compiling, 15
reusing, 10-11

890 Cat class

34 0672327112 index.qxd 11/19/04 12:31 PM Page 890

Free download pdf