< Previous | Contents | Next >

C

C programming language, 36 Cþþ program, 5–10

commenting code, 7 creating first program with,

383–388

Index 401


displaying text through standard defining member functions, Constructor Critter program,

output, 8–9 258–259 261–262

Game Over program, 5–6 instatiating objects, 259 constructors, 260–264

including other files, 7–8 Simple Critter program, base class, 379

main() function, 8, 10 256–257 calling automatically, 263–264 terminating statements, 9 setting member access levels, Constructor Critter program, whitespace, 7 264–269 261–262

calling defining accessor member declaring and defining, base class member functions, functions, 267–268 262–263

345–346 defining constant member defined, 282

constructors, 263–264 functions, 268–269 instantiating objects from

end()vector member function, Private Critter program, derived class, 336 127–128 264–266 containers

functions, 70, 154 specifying public and adaptors, 147

inlined functions, 179–180 private, 266–267 associative, 138 member functions, 260 static data members data members, 291–292 overloaded functions, 177 accessing, 272–273 defined, 145

static member functions, declaring, 272 sequential, 138–139 273–274 initializing, 272 continue statement, 59, 61,

camel case, 20 Static Critter program, 77, 111

capacity()member function, 270–271 copy constructors, 326

136–137 static member functions declaring, 309–313

Card class, BlackJack, 357, calling, 273–274 defining, 309–313

359, 361–363 declaring, 273 using in derived classes,

case sensitivity, 20, 38, 258 defining, 273 346–347

cctype file, 142 Static Critter program, Counter program, 82–84

change_global() function, 169 270–271 cout object, 8–9, 36

char type, 19tbl, 112 clear()member function, 122 Critter Caretaker game, 274–281 char value, 158 code profiling, 185–186 Critter class, 277–280 character variables, 21–22 combined assignment operators, class constructor, 277–278 cin object, 36 26–27 class definition, 277

classes, 255–283 commenting code, 7 Eat() member function,

See also advanced classes comments, 7, 37 279–280

constructors, 260–264 compile errors, 4 GetMood() member calling automatically, compiler, defined, 2 function, 278

263–264 compiler warning, 37 PassTime() member Constructor Critter computerMove()function, function, 278

program, 261–262 Tic-Tac-Toe game, Play() member function, declaring and defining, 213–216 280

262–263 concatenating string objects, 92 Talk() member function, Critter Caretaker game, const keyword, 170, 234, 279

274–281 249, 251, 269 main() function, 280–281

Critter class, 277–280 constant iterator, 126 planning game, 275–276 main() function, 280–281 constant member functions, planning pseudocode, planning game, 275–276 268–269 276

planning pseudocode, 276 constant pointer, 246–247, 249 Critter Farm program,

defined, 282 constant reference, 197–198, 218 288–290

defining new types, 255–260 constants, 29–32 cstdlib file, 78

accessing data members, defined, 36 cstring file, 102

259–260 enumerations, 31–32 C-style comments, 7

calling member functions, Game Stats 3.0 program, C-style strings, 101–102

260 29–30 curly braces

declaring data members, 258

global, 170

functions, 8

declaring member

overview, 31

nested scopes, 165

functions, 258

pointers and, 231–234

scopes, 163

402 Index