< Previous | Contents | Next >

P

pAPointer pointer, 226

parameters, 153

versus arguments, 184 assigning default arguments,

173174

functions, 158160

parentheses

dereferencing iterators, 129

order of operations, 15, 67

passing pointers, 234238

constant pointer, 237238 Swap Pointer Version program,

234236

by value, 236237

passing references

to alter arguments, 191194 passing by reference, 194 passing by value, 193194 Swap program, 191193

constant references, 197198 Inventory Displayer program,

195196

pitfalls, 196197

PassTime() member function,

Critter class, 278 Peek() global function, 295 planning programs, 139141

pseudocode, 139140

stepwise refinement, 140141

Play Again 2.0 program, 5657 Play Again program, 5455

Play() member function,

Critter class, 280

Player class

BlackJack game, 357, 359,

368369

Game Lobby program, 316318

pointers, 223250

arrays and, 244248 Array Passer program,

244246

constant pointer, 246247 passing and returning,

247248

assigning addresses to, 227228

constants and, 231234

dangling, 301, 325

declaring, 226227 declaring data member, 307 defined, 248

dereferencing, 228229

initializing, 227

passing, 234238

constant pointer, 237238 Swap Pointer Version

program, 234236

by value, 236237

Pointing program, 224226

reassigning, 229

returning, 238244

Tic-Tac-Toe 2.0 game, 248 using with objects, 230231

Pointing program, 224226 Polymorphic Bad Guy program,

347350

polymorphism, 347380

abstract classes, 352356 Abstract Creature program,

352354

declaring pure virtual functions, 354355

deriving classes from, 355356

Blackjack game, 356379

Card class, 361363

Deck class, 370373

designing classes, 356360

Game class, 373376

GenericPlayer class, 366367

Hand class, 363366

House class, 369370

main() function, 376377 overloading the operator()

function, 377379

Index 407



planning game logic, 360361

Player class, 368369 defining virtual destructors,

351352

Polymorphic Bad Guy program, 347350

using base class pointers to derived class objects, 350351

pop_back() member function

adding or removing elements, 138

vectors, 122

postfix increment operator, 2728 precedence level, operators, 15 predicate function, 113

prefix increment operator, 2728 premature optimization, 186

preprocessor, 7

priority queue, 148

priority_queue STL container, 139

Private Critter program, 264266

private keyword, 267

private members, 282 class access levels, 267 defined, 340

procedural programming, 283

profiling code, 180

program, defined, 35

protected members, 340, 379 prototypes, function

overview, 153

parameter names and, 159 pScore pointer, 224 pseudocode

Critter Caretaker game, 276 defined, 146

Tic-Tac-Toe game, 204 when to use, 148

pseudorandom number, 70, 79

ptrToElement() function, 241242

public derivation, 379

public inheritance, 356

public keyword, 258, 266

public members, 282 class access levels, 266 defined, 339

pure virtual function, 380

push_back() member function, 292

adding or removing elements, 138

vectors, 120


pushing, BlackJack, 356

puzzle games, 107