|
 |
 |
[an error occurred while processing this directive]
INDEX
- Symbols
- #include directive, 14
- >> operator, 20
- * operator, purpose of, 34
- << operator, 15
- = (assignment) operator, 116
- == operator, 328
- A
- abort function, 375, 391-393
- abstraction, 56
- access
- elements (built-in arrays), 254
- encapsulated data, 109
- classes, 144-148
- variables, 169-174
- access control (keywords), 121
- access functions, 132
- access specifiers, 76
- accessor member functions, 90
- accessors (member functions), 77
- accumulate algorithm, 346-351
- accumulated sums (container elements), 319, 345-351
- actions (container ranges, repeating), 318, 333-337
- addition operator (+), overloading, 134
- addRecord function, 377
- addRecord method, 379-380
- algorithms
- accumulate, 346-351
- count, 329
- equal, 318, 338-341
- find, 329
- for each, 333-337
- functionality, increasing, 333
- legacy code, 287
- member functions, 316
- mismatch, 318, 338-341
- mutating, 362
- mutation operations, 316
- nonmutating operations, 316
- nonmutative, 334
- numeric operations, 316-318
- partial sum, 346-351
- predicates (power), 333
- search, 342-345
- sort (vectors), 358
- sorting operations, 316-317
- Standard C Library, 287-312
- STL algorithms, 288, 316
- unique, 320, 325, 329
- aliases (namespaces), 553
- alignment, 511
- allocation
- containers, automatic, 268-273
- embedded allocators (STL containers), 253
- memory, 376
- dynamic, 475-479
- at runtime, 41
- analyzing source code, 13-15
- allocating and deallocating memory program, 39-41
- calculations program, 18-19
- derived data types program, 31-36
- exception handling program, 44-49
- loop statements, 22-23
- angle brackets (templates), 252
- ANSI C macros (runtime error handling), 383
- appending arrays, 248
- applications, terminating, 375, 391-393
- arguments
- char *argv[], 16
- int argc, 16
- prot, 528
- qsort function, 292
- unique algorithm, 325
- value, 32
- array allocation statement, 40
- arrays, 35
- appending, 248
- built-in
- element access, 254
- pointers, 273
- characters, 119
- compound data types, 220
- declaring, 100
- delete operator, overloading, 455-469
- deleting, memory leaks and, 450-451
- double values (template classes), 232
- elements, locating, 289, 298-305
- for each algorithm, 334-337
- new operator, overloading, 455-469
- programs, writing, 29-36
- qsort function, 288
- sorting, 288-297
- qsort function, 289-292
- strings, 296
- stacks as, 119
- template classes, 229-231
- assert function, 385-386
- assert utility, 374
- assignment operator, 116
- asterisk (*) in function pointers, 294
- at( ) member function, 249
- atexit function, 375, 393-395
- attributes, 55
- hiding, 90
- B
- bad alloc class, 45
- bad error, 533
- base classes, 57, 60-61
- inheritance, declaration, 194
- member functions (subclasses), 256
- binary files, 526, 536-542
- binary operators, overloading, 134-139
- BinaryFile object, 561
- binding
- dynamic binding, 293, 560-563
- late binding, 293
- static binding, 559
- block comments, 14
- block style, 15
- blocks
- catch, 46-48
- try, 46-48, 416-417
- bool data type, 20, 73
- braces in loops, 24
- bsearch function, 289, 298-301
- buffers
- dynamically creating, 128
- I/O libraries, 501
- size, adjusting automatically, 250
- built-in arrays
- elements, accessing, 254
- pointers, 273
- byte alignment settings, 448
- byte padding structures, 449
- C
- C comments, 288
- Calc( ) member function, 183
- calculations, writing, 17-20
- callback functions, 292-295
- calloc function, 376
- cast operator, 288
- catch block, 46-48
- catch clause, 416-425
- catch constructs, 410
- CATCH directory, 419
- catch ordering, 419-425
- changing references, 32
- char *argv[] argument, 16
- char data type, 20
- characters, 119
- cin object, 20
- class compatibility, 500, 503-504
- console stream, 526
- class keyword, 76
- classes, 55, 109, 169
- access (encapsulated data), 144-148
- bad alloc, 45
- base classes, 57, 60-61
- cin (compatibility), 500, 503-504
- constructors, 76, 121
- containers
- sequential, 318-328
- see also container classes
- cout (compatibility), 500, 503-504
- creating, 72-80
- declaration, 73, 120, 123
- header line, 196
- overloaded operators, 141
- writing, 131
- deconstructors, 121
- defining, 73
- delete operator, overriding, 451-455
- derived, 195
- member functions, 94
- variables, 201
- destructors, 77
- dynamically allocated memory clean up, 475-479
- encapsulated data access, 109
- errors (runtime), 376
- exception, 410, 425-429
- file stream, 528
- friend, 147-148
- fstream, reading/writing to files, 527
- functions, coding, 122
- ifstream, reading files, 527
- implementation, 73, 124
- constructor functions, 131
- destructor functions, 131
- inheritance, 56-62
- instantiation (macros), 502
- interfaces, 77
- internal information, hiding, 118
- IOStreams
- base classes, 501
- error conditions, 533
- linked list, 151
- members (static), 72, 97-101
- memory management, 473-495
- memory use, 447-450
- new operator, overriding, 451-455
- object clean up, 479-483
- ofstream, writing to files, 527-528
- runtime errors, 400-405
- Shape, 186-190
- size, 450
- sort order, 361
- SStack (data members), 120
- stack, defining, 123
- string, 264
- structures comparison, 108, 151-155
- templates, 220, 252
- testing, 124, 133
- TSimple, 227-228
- type_info, 564
- variables, access, 169-174
- views, 89-91
- virtual, 161, 206-216
- when to use, 128, 151-155
- clean up (classes), 479-483
- code
- access functions, 132
- modular, 128
- source
- compiling, 13
- described, 12
- linking, 13
- try block, 416-417
- code pointers, 292-295
- CodeGuard (Borland), 450
- coding class functions, 122
- comments
- block, 14
- C, 288
- line, 14
- styles, 14-17, 20, 24, 37, 41, 49
- compare callback function, 295
- comparison functions, 356
- comparisons
- lexicographical, 297
- sequences, 318, 337-341
- compilers
- DJGPP, 75
- function of, 13
- compiling
- source code, 13
- statements, troubleshooting, 16
- compound data types (template classes), 220, 228-232
- compound statements, 19
- conflicts in naming, see namespaces
- console streams
- cin, 526
- cout, 526
- const keyword, 20
- const modifier, 77
- const variable, 20
- constructor functions, class implementation, 131
- constructors, 121
- class instances, 181
- classes, 76
- defining (template classes), 222
- inline member functions, 99
- memory allocation, 78
- names, 186
- overloaded (signatures), 189
- private variables, 173
- selecting, 161, 186-190
- signatures, 186
- SStack, 124
- container classes, 247-284
- container objects, 249-254
- containers
- accumulated sums, 319
- allocation/reallocation, 268-273
- automatic, 249, 268-273
- memory allocation scheme, 268
- deque, 320
- elements, 250
- accumulated sums, 345-351
- accumulating, 319
- displaying all, 273-278
- modifying, 249, 257-260
- order, 319, 362-368
- reading, 249, 254-256
- sorting, 319
- ranges, repeating actions, 318, 333-337
- sequential (classes), 318-328
- sorting, 351-361
- stack, 261-268
- STL, 248-250
- embedded allocators, 253
- values
- searching for sequences, 319
- sequences, searching for, 341-345
- vector, 320
- conversion bases, 509-511
- count algorithm, 329
- cout, 36, 423
- class compatibility, 500, 503-504
- console stream, 526
- formatting with, 500, 504-515
- creating
- data types, 108
- loop statements, 21-25
- programs
- to allocate and deallocate memory, 37-41
- with derived data types, 29-36
- exception handling, 41-50
- without knowing C++, 12-17
- with one or more functions, 25-28
- to perform calculations, 17-20
- CurrentElement variable, 124
- D
- data, hiding from external programs, 118-128
- data declaration, 130
- data extraction (STL), 530-531
- data hiding, see encapsulation
- data members, 121
- encapsulation, 87
- SStack class, 120
- see also variables
- data models
- LIFO, 249, 261-268
- queue, 250, 278-281
- data operations (declaration), 352
- data pointers, 292-295
- data types, 108
- bool, 20, 73
- char, 20
- compound (template classes), 220, 228-232
- creating, 110-117, 129
- derived (programs)
- writing, 29-33, 35-50
- double, 20
- fields, 129
- float, 20, 136
- int, 14, 20
- long, 20
- template classes
- simple data types, 221-225
- undefined, 220, 233-238
- unknown, 222
- TSimple class, 227-228
- variables, 110
- databases, initialization, 415
- dbClose( ) function, 418
- dbCloseEH( ) function, 416
- dbGetDat( ) function, 417
- dbGetDataEH( ) function, 416
- dbInit( ) function, 415-417
- dbInitEH( ) function, 416
- dbOpen( ) function, 415-417
- dbOpenEH( ) function, 416
- DDate type, 113
- deallocation (self deallocation), 483-494
- debugging
- assert function, 385-386
- assert utility, 374
- inheritance and, 161
- memory management, 451
- decimal points, setting, 507-509
- declaration, 62-63
- arrays, 100
- classes, 73, 120, 123
- header line, 196
- writing, 131
- constructors, 76
- data, 130
- error handlers, 436
- inheritance, 194-195
- linked list classes, 152
- main (optional), 16
- member functions, 77
- namespaces, 551
- overloaded operators, 140
- relational operations, 352
- struct, 32-33
- declarative languages, 58
- deconstructors, 121
- deference operator, 34
- defining
- classes, 73
- constructors (template classes), 222
- enumeration types, 76
- pointers, 294
- variables (template classes), 235-236
- definitions
- errorCode, 45
- member functions, 196
- namespaces, 552-553
- stack classes, 123
- delete expression, 40
- delete operator, 444
- free( ) routines and, 445-446
- malloc( ) routines and, 445-446
- overloading for arrays, 455-469
- overriding for classes, 451-455
- user-defined, namespaces, 557
- delete[ ], 450-451
- deleting arrays, memory leaks and, 450-451
- deque container, 320-321
- derived classes
- creating, 195
- member functions, 94
- variables, 201
- derived data types (programs, writing), 29-50
- destructor functions (class implementation), 131
- destructors, 77-78
- directives
- #include, 14
- preprocessor, 14
- using, 75, 252
- described, 14
- namespaces, 552
- directories
- CATCH, 419
- EXCEPTH, 411
- EXCLASS, 426
- UNEXPECT, 434
- DisplayDate function, 116
- displaying container elements, 273-278
- divide( ) function, 428
- DJGPP compiler, 75
- do-while loop, 23
- dot notation (member functions), 160, 181-186
- dot operators, 79
- structures, 117
- double data type, 20
- dynamic binding, 293, 560-563
- dynamically allocated memory (clean up), 475-479
- dynamic_cast operator, 563, 566-567
- E
- ed as text editor, 12
- EH string, 414
- elements
- arrays
- locating, 298-305
- location, 289
- container ranges, repeating actions, 333-337
- containers, 250
- accumulated sums, 345-351
- accumulating, 319
- displaying all, 273-278
- modifying, 249, 257-260
- order, 319, 362-368
- reading, 249, 254-256
- sorting, 319
- vectors
- inserting, 250-254
- modifying, 257-260
- reading, 254-256
- ellipsis in catch clause, 424
- embedded allocators (STL containers), 253
- encapsulation, 54, 56, 62-63, 72, 87-91, 108, 122, 128-134
- accessing data, 144-148
- data access, 109
- friend functions and, 148
- security and, 134
- enumeration types, 76
- EOF (end of file), 526
- eof error, 533
- reading files, 529-532
- equal algorithm, 318, 338-341
- Equal( ) function, 163
- equality operators, overloading, 109, 139-144
- errno variable, clearing, 382
- error conditions (IOStreams classes), 533
- error detection
- reading files, 375, 395-397
- writing to files, 375
- error handlers, declaration, 436
- error handling, 374-407
- function error values, 400
- maintaining state, 397-399
- programs, writing, 41-50
- raise function, 387-391
- runtime errors, 374
- signal function, 387-391
- stream errors, 526
- streams, 532-535
- ErrorClass, 400, 402, 405
- errorCode definition, 45
- errors
- bad, 533
- eof, 533
- fail, 533
- off-by-one, 529-532
- one-off, 35
- potential, exception handling, 411-418
- run time (classes), 400-405
- runtime, reporting, 381-385
- runtime errors, 376-381
- stream errors, reading loop, 529
- examining source code
- allocating and deallocating memory program, 39-41
- calculations program, 18-19
- derived data types program, 31-36
- exception handling program, 44-49
- first C++ program, 13-15
- loop statements, 22-23
- EXCEPTH directory, 411
- exception classes, 410
- implementation, 425-429
- exception handling, 409-439
- LIFO data model, 261
- potential error conditions, 411-418
- programs, writing, 41-50
- rethrowing exceptions, 410
- exception specification, 45
- exceptions
- functions, specifying, 410
- rethrowing, 410, 419-425
- specifying for functions, 430-434
- unexpected, 434-437
- EXCLASS directory, 426
- exit function, 375, 393-395
- ExitCurrentScope, 267
- exiting functions, forcing, 267
- expressions
- delete, 40
- initializer, 40
- new, 39-40, 79
- return, 15
- validity testing, 385
- external functions (file-local function), 555-556
- external programs, hiding data, 118-128
- extracting data (STL implementations), 530-531
- extraction operator
- described, 20
- overloading, 242
- F
- fail error, 533
- ferror function, 375, 396
- fields (data types), 129
- FIFO (first-in-first-out), 279
- file I/O, 525-547
- file stream classes, 528
- file streams, opening, 526-529
- file-local functions (external functions), 555-556
- files
- binary, reading/writing, 536-542
- header files, 76, 288
- iostream, 16
- opening, writing to, 536
- reading
- different positions, 542-546
- error detection, 375, 395-397
- ifstream class, 527
- reading from (different positions), 526
- reading/writing to (ifstream class), 527
- stack.h, 123
- writing to
- different positions, 526, 542-546
- error detection, 395-397
- ofstream class, 527-528
- find algorithm, 329
- float data type, 20, 136
- float values (Transaction float), 347
- floating-point numbers, 192, 512-514, 536
- for each algorithm, 333-337
- for loop, 24-25, 100
- forcing function exit, 267
- formatting
- alignment, 511
- comments, 14-17, 20, 24, 37, 41, 49
- conversion bases, 509-511
- cout, 500, 504-515
- decimal points, 507-509
- floating-point numbers (scientific notation), 512-514
- ostream objects, 500, 504-515
- positive numbers, 511
- whitespace, 507
- free( ) function, 444-469
- deleting operator and, 445-446
- new operator and, 445-446
- friend classes, 147-148
- friend functions, 145-148
- fstream class, reading/writing to files, 527
- function calls, results, 415
- function members, 121
- function overloading, implementing, 161
- function pointers, 293
- functions
- abort, 375, 391-393
- access functions, 132
- addRecord, 377
- assert, 385-386
- atexit, 375, 393-395
- bsearch, 298-301
- callback functions, 292, 295
- calloc, 376
- class functions, coding, 122
- comparison functions, 356
- constructor, class implementation, 131
- dbClose( ), 418
- dbCloseEH( ), 416
- dbGetData( ), 417
- dbGetDataEH( ), 416
- dbInit( ), 415, 417
- dbInitEH( ), 416
- dbOpen( ), 415, 417
- dbOpenEH( ), 416
- destructor, class implementation, 131
- Display Date, 116
- divide( ), 428
- Equal( ), 163
- error values, 400
- exception throwing, specifying exceptions, 430-434
- exceptions, specifying, 410
- exit, 375, 393-395
- ferror, 375, 396
- forcing exit, 267
- free( ), 444-469
- friend, 145-148
- GetDate, 116
- getValue, 32-36
- identify, 560
- inlining, 477
- InterruptHandler, 388
- IsEmpty, 119
- IsFull, 119
- lfind, 289
- long, 31-32
- longjmp, 375, 397-399
- lookup functions, 302-309
- lsearch, 289
- main
- described, 14
- optional declarations, 16
- malloc( ), 376, 444-469
- member functions, 121
- accessors, 90
- at( ), 249
- declaration, 77
- dot notation, 160
- inline, 99
- overloading, 76
- overloading addition operator, 134
- set( ), 173
- SStack class, 120
- static, 100-101
- memcpy( ), 446-447
- memmove, 446-447
- multiply, 32
- mutator, 77
- NameExists, 326
- names, 191
- new, 376
- nonvirtual, 207
- overloading, implementing, 191-194
- perror, 374, 381-385
- Pop, 119
- PrintM, 334
- program, writing with one or more, 25-28
- Push, 119
- qsort, 288-292, 298
- raise, 375, 387-391
- rand, 309-311
- RemoveDuplicates, 325
- Result( ), 163
- rethrowFunc( ), 421-422
- return values, 49
- setjmp, 375, 397-399
- signal, 375, 387-391
- srand, 309-311
- SStack( ), 121
- stdio functions, 499
- stdio.h file, 288
- strerror, 374, 381-385
- sync_with_stdio( ), 501
- terminate( ), 417
- TerminateHandler, 388
- throwFunc( ), 421-422
- unary functions (predicates), 329
- validation code, 132
- virtual, 206-207, 561-563
- G
- Gather( ) member function, 183
- generating random numbers, 289, 309-311
- get( ) member function, 173
- GetDate function, 116
- getValue function, 32-36
- global data, 109, 148-151
- global functions, scope resolution (::) operator, 555
- global variables, 169-174
- GNU projects, 501
- H
- handling errors, see error handling
- header files, 76, 556, 288
- hiding data from external programs, 118-128
- hierarchies, inheritance, 81
- hierarchy, 59
- I
- I/O
- file I/O, 525-547
- operations, 288
- streams library, 499-521
- identify function, 560
- ifstream class, reading files, 527
- if_else statements, 415
- implementation, 56
- classes, 73, 124
- constructor functions, 131
- destructor functions, 131
- encapsulation, 87
- exception classes, 425-429
- print manager, 281
- static polymorphism, 559
- implementations (STL), 530-531
- implementing, overloading functions, 191-194
- include statements (containers), 252
- indented block style, 15
- indexes, sorting indexes, 351-361
- inheritance, 54-62, 72, 80-87, 161, 194-199
- debugging and, 161
- declaring, 195
- hierarchies, 81
- member variables, 202
- model, 209-210, 214-216
- multiple, 563
- parameter passing, 161, 200-206
- properties, 200
- templates, 256
- initialization
- databases, 415
- instances (constructors), 76
- initializer expression, 40
- initializer list, 78
- inline functions, 477
- inline member functions (constructors), 99
- inserting elements in vectors, 250-254
- insertion operator, 15
- overloading, 238, 242
- instances
- initializing (constructors), 76
- objects, 186
- instantiation (classes), 502
- int argc argument, 16
- int data type, 14, 20
- integer values
- int data type, 14
- private variables, 184
- integers, 192
- interface, 56, 77, 87
- interpreting source code
- allocating and deallocating memory program, 39-41
- calculations program, 18-19
- derived data types program, 31-36
- exception handling program, 44-49
- first C++ program, 13-15
- loop statements, 22-23
- InterruptHandler function, 388
- iostream file, 16
- iostream member functions, 173
- IOStreams base classes, 501
- IOStreams classes, 533
- IOStreams library, 525-547
- is-a relationships, 57
- ISAM (Indexed Sequential Access Methods) C libraries, 414
- IsEmpty function, 119
- IsFull function, 119
- istream operators (>>), 503-504
- iterators, 250, 277
- container elements, 274
- list items (pointers), 326
- pattern vector, 339
- iVal variable, 35-36
- J-K
- jumps (non-local), 375
- K&R style, 15
- keywords
- access control, 121
- class, 76
- const, 20
- namespace, troubleshooting, 16
- private, 121
- public, 121
- static, 97-101
- struct, 110
- DDate type, 113
- described, 32
- try, 416
- virtual, 94
- Koenig loookup, 554
- L
- languages
- declarative, 58
- typed, 219
- late binding, 293
- leaks, memory, preventing, 450-451
- legacy code, algorithms and, 287
- lexicographical comparison, 297
- lfind function, 289, 302-309
- libraries
- I/O streams library, 499-521
- IOStreams, 525-547
- stdio, 499
- LIFO (last-in-first-out) data model, 249, 261-268
- line comments, 14
- linked list classes, 151-152
- linkers, 13
- linking source code, 13
- lists
- linked list classes, 151
- sequential containers, 321
- long data type, 20
- long function, 31-32
- longjmp function, 375, 397-399
- lookup functions
- lfind, 302-309
- lsearch, 302-309
- loop statements, writing, 21-25
- loops
- braces, 24
- do-while, 23
- for, 24-25
- for loops, 100
- reading loop, stream errors, 529
- while, 23
- while loops, 184
- lsearch function, 289, 302-309
- M
- macros, 502
- main function, 14-16
- malloc( ) function, 376, 444
- delete operator and, 445-446
- new operator and, 445-446
- manipulators
- setf( ), 511
- setfill( ), 507
- setw( ), 505-507
- stream manipulators, 515-521
- unsetf( ), 511
- MAX ELEMENTS constant, 39
- member functions, 121
- accessors, 77, 90
- algorithms, 316
- at( ), 249
- base classes (subclasses), 256
- Cal( ), 183
- declaration, 77
- definitions, 196
- derived classes, 94
- dot notation, 160, 181-186
- duplicate names, 179
- Gather( ), 183
- inline (constructors), 99
- invoking, 183
- iostream, 173
- message( ), 427
- methods, 179
- overloading, 76
- public visibility classes, 77
- set( ), 173
- Show( ), 183
- SStack class, 120
- static, 100-101
- streams, 543
- template classes, 222, 226
- unique, 320
- virtual, 206
- virtuality, 94
- visibility, 90
- member variables, inheritance, 202
- members (classes), 72
- memcpy( ) function, 446-447
- memmove( ) function, 446-447
- memory
- allocation and deallocation, 376
- at runtime, 41
- desructors, 78
- operating systems, 475
- programs
- dynamically allocated, clean up, 475-479
- leaks
- deleting arrays and, 450-451
- preventing, 450-451
- object use, 447-450
- structure use, 447-450
- virtual classes, 216
- writing, 37-41
- memory management
- classes, 473-495
- debugging, 451
- memory manipulation functions, 446
- mem( ) routines, 446-447
- MemPtr object, 479
- message( ) member function, 427
- messages, 15
- methods, 121
- addRecord, 379-380
- member functions, 179
- predicates (count algorithm), 329
- mismatch algorithm, 318, 338-341
- modifiers (const), 77
- modifying
- elements
- containers, 257-260
- containters, 249
- vectors, 257-260
- namespaces (std), 557
- references, 32
- modular code, 128
- modules (global data), 109
- multiple inheritance, 563
- multiply function, 32
- multithreaded programming, 485-486
- mutating algorithms, 362
- mutating operations, 316
- mutator functions, 77
- mutex (mutliple exclusion semaphore), 486
- MyChar, 448
- MyLongInt, 448
- N
- name conflicts, 550-551
- NameExists function, 326
- names
- constructors, 186
- functions, 191
- namespace keyword, troubleshooting, 16
- namespaces, 549-558
- aliases, 553
- definition, 552-553
- delete operator, user-defined, 557
- described, 14
- external functions, 555-556
- file-local functions, 555-556
- header files, 556
- interaction with other language features, 554
- Koenig lookup, 554
- new operator, user-defined, 557
- properties, 551
- restrictions, 557
- std, 550, 557
- using-declaration, 551-552
- using-directive, 552
- new expression
- described, 39-40
- object creation, 79
- new function, 376
- new operator, 444
- free( ) routines and, 445-446
- malloc( ) routines and, 445-446
- objects (clean up), 479-483
- overloading for arrays, 455-469
- overriding for classes, 451-455
- user-defined (namespaces), 557
- non-local jumps, 375
- nonmutating operations (algorithms), 316
- nonmutative algorithms, 334
- nonvirtual functions, 207
- nonvirtual inheritance model, 210, 214-216
- Notepad as text editor, 12
- numbers, (random, generating), 289, 309-311
- numeric operations (algorithms), 318
- O
- object-oriented approach vs procedural, 160-162, 165-169
- object-oriented paradigm, 55-56
- object-oriented programming, see OOP
- objects, 55
- BinaryFile, 561
- cin, 20
- clean up, 479-483
- container, 249-254
- creating
- dot notation, 183
- new expression, 79
- instances, 186
- member functions, invoking, 183
- memory use, 447-450
- MemPtr, 479
- ostream, formatting with, 500, 504-515
- polymorphic (RTTI), 563
- proxy, 37
- references, 32
- self-deallocating, 483-494
- size, 450
- TextFile, 561
- ofstream class
- opening files, 536
- writing to files, 527-528
- Ohms law, 207
- one-off error, 35
- OOP (object-oriented programming), 53, 159
- basics, 54
- encapsulation, 54
- inheritance, 54, 57-62
- polymorphism, 54
- return two letters, 168
- opening
- file streams, 526-529
- files, writing to, 536
- operating systems, memory allocation, 475
- operations
- algorithms, 316
- sequence (predicates), 318, 328-333
- operator overload, 134-139
- declaration, 140
- equality operators, 139-144
- relational operators, 139-144
- testing, 143
- operators, 109
- ==, 328
- assignment operator, 116
- binary, overloading, 134-139
- cast, 288
- creating, 134-139
- deference, 34
- delete, 444-469
- overloading for arrays, 455-469
- overriding for classes, 451-455
- dot operator, 79, 117
- dynamic_cast, 563, 566-567
- extraction
- described, 20
- overloading, 242
- insertion
- described, 15
- overloading, 242
- istream (>>), 503-504
- new, 444-469
- overloading for arrays, 455-457, 459-469
- overriding for classes, 451-455
- ostream (<<), 503-504
- overloading, 109
- scope resolution, 124, 160
- scope resolution (::) operator, 175-180, 55
- sizeof( ), 450
- typeid, 97, 564-566
- unary, overloading, 138
- order of container elements, 319, 362-368
- ostream objects, formatting, 500, 504-515
- ostream (<<) operators, 503-504
- output
- setw( ) manipulator, 505-507
- described, 15
- overloading
- constructors, 186, 189
- deleting operator, 455-469
- functions
- implementing, 191-194
- implementing overload, 161
- member functions, 76
- insertion operator, 238, 242
- new operator (arrays), 455-469
- operator overloading, 134
- operators, 109
- binary, 134-139
- testing, 143
- unary, 138
- subscript operator, 254
- overriding operators, 451-455
- P
- parameters, passing to parent classes through inheritance, 161, 200-206
- partial sum algorithm, 346-351
- passing parameters to parent classes through inheritance, 161, 200-206
- pattern vector, 338-339
- perror function, 374, 381-385
- pointer variables, 294
- pointers
- arrays (built-in), 273
- code pointers, 292-295
- data pointers, 292-295
- defining, 294
- described, 32
- function pointers, 293
- programs, writing, 29-36
- references, changing, 32
- values, storing, 32
- polymorphism, 54-56, 64-67, 72, 91-97, 559
- static, implementing, 559
- type_info class, 564
- Pop function, 119
- position-related stream member functions, 543
- positive numbers, 511
- predicates
- algorithms, 333
- methods (count algorithm), 329
- sequence operations, 318, 328-333
- preprocessor directives, 14
- preventing memory leaks, 450-451
- print manager, implementation, 281
- printing to screen, 202
- PrintM function, 334
- private keyword, 121
- private variables, 169-174
- constructors, 173
- integer values, 184
- procedural approach versus object-oriented, 160-169
- procedural programs, returning two letters, 167
- programs
- creating to perform calculations, 17-20
- external, hiding data, 118-128
- writing
- to allocate and deallocate memory, 37-41
- with derived data types, 29-36
- exception handling, 41-50
- without knowing C++, 12-17
- loop statements, 21-25
- with one or more functions, 25-28
- properties
- inheritance, 200
- namespaces, 551
- prot argument, 528
- proxy objects, 37
- pseudorandom numbers, 310
- public keyword, 121
- public variables, 169-174
- public visibility, member functions, 77
- Push function, 119
- pushing data into stacks, 119
- Q
- qsort function, 288-292, 298
- callback function, 294
- queue data model, 250, 278-281
- R
- raise function, 375, 387-391
- rand function, 309-311
- random numbers
- generating, 289, 309-311
- pseudorandom, 310
- ranges (containers), repeating actions, 318, 333-337
- rational operators, overloading, 109
- reading
- binary files, 526, 536-542
- container elements, 254-256
- elements
- containers, 249
- vectors, 254-256
- files
- different positions, 526, 542-546
- ifstream class, 527
- reading files
- EOF, 526, 529-532
- error detection, 375, 395, 397
- errors (off-by-one), 529-532
- reading loop (stream errors), 529
- reading/writing files (ofstream class), 527
- reallocating containers, automatic, 249, 268-273
- references
- changing, 32
- values, storing, 32
- relational operations
- declaration, 352
- overloading, 139-144
- RemoveDuplicates function, 325
- restrictions on namespaces, 557
- Result( ) function, 163
- rethrowFunc( ) function, 421-422
- rethrowing exceptions, 410, 419-425
- return statement
- calculations program, 19
- described, 15
- return values, 49
- reviewing source code
- allocating and deallocating memory program, 39-41
- calculations program, 18-19
- derived data types program, 31-36
- exception handling program, 44-49
- first C++ program, 13-15
- loop statements, 22-23
- rotating sequences, 362
- RTTI (runtime type information), 563
- runtime, allocating, 41
- runtime errors, 374-381
- classes, 376, 400-405
- reporting, 381-385
- runtime type information, 559-568
- see also RTTI
- S
- satellite data, 154
- scientific notation (floating-point numbers), 512-514
- scope (namespaces), 551
- scope resolution (::) operator, 124, 160, 175-180
- global functions, 555
- search algorithm, 342-345
- searches (containers)
- value sequences, 319
- values, 341-345
- security, encapsulation and, 134
- seeking in streams, 545
- semaphores, 486
- sequence operations (predicates), 318, 328-333
- sequences
- accumulated sums (container elements), 345-351
- comparing, 318, 337-341
- container values, searching for, 341-345
- sequeneces
- rotating, 362
- sequential containers
- classes, 318-328
- deques, 321
- lists, 321
- vectors, 321
- services, 59
- set( ) member function, 173
- setf( ) manipulator, 511
- setfill( ) manipulator, 507
- setjmp function, 375, 397-399
- setprecision( ) modifier, 507-509
- setw( ) manipulator, 505-507
- Shape class, 186-190
- sharing data, 148
- see also global data
- Show( ) member function, 183
- signal function, 375, 387-391
- signals, 389-390
- signatures (constructors), 186, 189
- size
- buffers, adjusting automatically, 250
- containter objects, 250-254
- vectors, 252
- sizeof( ) operator, 450
- sort order (classes), 361
- sorting
- arrays, 288-297
- qsort function, 289-292
- strings, 296
- container elements, 319, 351-361
- indexes (containers), 351-361
- vectors (sort algorithm), 358
- sorting operations (algorithms), 316-317
- source code
- analyzing
- allocating and deallocating memory program, 39-41
- calculations program, 18-19
- derived data types program, 31-36
- exception handling program, 44-49
- first C++ program, 13-15
- loop statements, 22-23
- comments, 14-17, 20, 24, 37, 41, 49
- compiling, 13
- described, 12
- linking, 13
- specialization, 252
- specifications (exception), 45
- srand function, 309-311
- SStack class, 120
- SStack constructor, 124
- SStack( ) function, 121
- stack classes, defining, 123
- stack container, 261-268
- stack.h file, 123
- stacks
- as arrays, 119
- characters, 119
- pushing data into, 119
- Standard C Library algorithms, 287-315
- standard header files (namespaces), 556
- standard output messages, 15
- Standard Template Library (self-managing pointer class), 479
- Standard Template Library, see STL
- starting point in C++ programs, 14
- statements
- array allocation, 40
- compiling, troubleshooting, 16
- compound, 19
- cout, 36, 423
- if_else, 415
- loop, writing, 21-25
- return
- calculations program, 19
- described, 15
- throw, 418
- try block, 416
- static binding, 559
- static class members, 97-101
- implementing, 72
- static keyword, 97-101
- static member functions, 100-101
- static polymorphism, implementing, 559
- std namespace, 550, 557
- stdio (GNU), 501
- stdio functions, 499
- stdio library, 499
- stdio.h file functions, 288
- STL (Standard Template Library), 316, 479
- algorithms, 288, 316
- containers, 248-250, 253
- implementations, 530-531
- storing
- values, 32
- variables, 165
- stream errors, reading loop, 529
- stream manipulators, 500, 515-521
- streams
- data extraction, 530
- error handling, 532-535
- error handling , 526
- files streams, opening, 526-529
- member functions (position-related), 543
- seeking in, 545
- strerror function, 374, 381-385
- string class, 264
- strings
- array, sorting, 296
- EH, 414
- lexicographical comparison, 297
- Stroustrup, Bjarne, 120
- struct declaration, 32-33
- struct keyword, 110
- DDate type, 113
- described, 32
- structure members, 117
- structures, 108-109
- byte padding, 449
- classes comparison, 108, 151-155
- memory use, 447-450
- settings, working with all, 449
- size, 450
- template classes, 221, 238-243
- variables, 117
- when to use, 128, 151-155
- styles
- block, 15
- comments, 14-17, 20, 24, 37, 41, 49
- indented block, 15
- K&R, 15
- subscript operator, overloading, 254
- sync_with_stdio( ) function, 501
- T
- template classes
- arrays, 229
- double values, 232
- simple data types, 231
- compound data types, 220, 228-232
- constructors, defining, 222
- data types
- simple, 221-225
- undefined, 220, 233-238
- member functions, 222, 226
- reading in data, 220, 225-228
- structures, 221, 238-243
- variables, defining, 235-236
- templates
- angle brackets, 252
- class, 252
- inheritance, 256
- terminate( ) function, 417
- TerminateHandler function, 388
- terminating applications, 375, 391-393
- testing
- classes, 124, 133
- operator overload, 143
- text editors
- ed, 12
- Notepad, 12
- vi, 12
- TextFile object, 561
- threads, 486
- throw statement, 418
- throwFunc( ) function, 421-422
- Transaction vector float values, 347
- troubleshooting
- keywords (namespace), 16
- statements (compiled), 16
- try block, 417
- described, 46-48
- exception classes, 428
- statements, 416
- try keyword, 416
- TSimple class, 227-228
- typed languages, 219
- typedef (error handler declaration), 436
- typeed operator, 564-566
- typeid operator, 97
- types
- classes, 55
- declaring, 76
- type_info class, 564
- U
- unary functions (predicates), 329
- unary operators, overloading, 138
- undefined data types (template classes), 220, 233-238
- UNEXPECT directory, 434
- unique algorithm, 320, 329
- unique member function, 320
- UNIX text editors, 12
- unknown data types, 222
- TSimple class, 227-228
- unsetf( ) manipulator, 511
- user-defined operators (namespaces), 557
- using directive, 14, 75, 252, 552
- using-declaration (namespaces), 551-552
- V
- validation code (functions), 132
- validity testing (expressions), 385
- value argument, 32
- values
- containers, 319, 341-345
- integer (int data type)
- described, 14
- pointers, storing, 32
- references, storing, 32
- return, 49
- variables (function cal results), 415
- variables
- access, 169-174
- const, 20
- CurrentElement, 124
- data members, 160
- data types, combining into, 110
- derived classes, 201
- global, 169-174
- iVal, 35-36
- pointer variables, 294
- private, 169-174, 184
- protected, 201
- public, 169-174
- reading in data (template classes), 220, 225-228
- specifying, 111
- storage (main), 165
- structures, 117
- template classes, defining, 235-236
- values (function call result), 415
- vector container, 320
- vectors
- class template, 252
- elements
- inserting, 250-254
- modifying, 257-260
- reading, 254-256
- pattern vector, 338
- sequential containers, 321
- size, 252
- sorting (sort algorithm), 358
- Transaction (float values), 347
- vi text editor, 12
- views (classes), 89-91
- virtual classes, 161, 206-216
- memory, 216
- model, converting to nonvirtual inheritance model, 214-216
- virtual functions, 206-207
- dynamic binding, 561-563
- virtual keyword, 94
- virtual member functions, 94, 206
- visibility (member functions), 90
- void pointer (bsearch function), 300
- W-Z
- while loop, 23, 184
- whitespace, setting, 507
- writing
- binary files, 526, 536-542
- loop statements, 21-25
- programs
- to allocate and deallocate memory, 37-41
- with derived data types, 29-36
- exception handling, 41-50
- without knowing C++, 12-17
- with one or more functions, 25-28
- to perform calculations, 17-20
- writing to files
- different positions, 526, 542-546
- error detection, 375, 395-397
- fstream class, 527
- ofstream class, 527-528
- opening, 536
|