1300 187 187
 
C++ : A Beginner's Guide : 2nd Edition - Herbert Schildt

C++ : A Beginner's Guide

2nd Edition

Paperback

Published: 1st December 2003
Ships: 7 to 10 business days
7 to 10 business days
RRP $35.95
$31.90
11%
OFF

Essential skills made easy! Written by Herb Schildt, the world?s leading programming author, this step-by-step book is ideal for first-time programmers or those new to C++. The modular approach of this series, including sample projects and progress checks, makes it easy to learn to use C++ at your own pace.

About the Author

Herbert Schildt (Mahomet, IL) is a leading programming author. He is an authority on the C, C++, Java, and C# programming languages, and a master Windows programmer. His programming books have sold more than three million copies worldwide and have been translated into all major foreign languages. He is the author of numerous best-sellers including, C++: The Complete Reference, C: The Complete Reference, C++ from the Ground Up, Java 2: The Complete Reference, Java 2: A Beginner's Guide, C#: A Beginner's Guide, The Art of Java and many more. Schildt holds a master's degree in computer science from the University of Illinois.

Prefacep. xix
C++ Fundamentalsp. 1
A Brief History of C++p. 2
C: The Beginning of the Modern Age of Programmingp. 2
The Need for C++p. 3
C++ Is Bornp. 4
The Evolution of C++p. 4
How C++ Relates to Java and C#p. 5
Object-Oriented Programmingp. 7
Encapsulationp. 7
Polymorphismp. 8
Inheritancep. 9
A First Simple Programp. 10
Entering the Programp. 11
Compiling the Programp. 11
Run the Programp. 12
The First Sample Program Line by Linep. 12
Handling Syntax Errorsp. 15
A Second Simple Programp. 16
Using an Operatorp. 17
Reading Input from the Keyboardp. 19
Some Output Optionsp. 21
Another Data Typep. 22
Converting Feet to Metersp. 24
Two Control Statementsp. 26
The if Statementp. 27
The for Loopp. 28
Using Blocks of Codep. 30
Semicolons and Positioningp. 32
Indentation Practicesp. 33
Generating a Table of Feet to Meter Conversionsp. 33
Introducing Functionsp. 36
The C++ Librariesp. 38
The C++ Keywordsp. 38
Identifiersp. 39
Module 1 Mastery Checkp. 40
Introducing Data Types and Operatorsp. 43
Why Data Types Are Importantp. 44
The C++ Data Typesp. 44
Integersp. 47
Charactersp. 48
Floating-Point Typesp. 50
The bool Typep. 51
voidp. 53
Talking to Marsp. 53
Literalsp. 55
Hexadecimal and Octal Literalsp. 56
String Literalsp. 56
Character Escape Sequencesp. 56
A Closer Look at Variablesp. 59
Initializing a Variablep. 59
Dynamic Initializationp. 60
Operatorsp. 61
Arithmetic Operatorsp. 61
Increment and Decrementp. 62
Relational and Logical Operatorsp. 64
Construct an XOR Logical Operationp. 67
The Assignment Operatorp. 69
Compound Assignmentsp. 70
Type Conversion in Assignmentsp. 71
Expressionsp. 71
Type Conversion in Expressionsp. 72
Castsp. 72
Spacing and Parenthesesp. 73
Compute the Regular Payments on a Loanp. 74
Module 2 Mastery Checkp. 77
Program Control Statementsp. 79
The if Statementp. 80
The Conditional Expressionp. 82
Nested ifsp. 83
The if-else-if Ladderp. 84
The switch Statementp. 85
Nested switch Statementsp. 89
Start Building a C++ Help Systemp. 91
The for Loopp. 93
Some Variations on the for Loopp. 95
Missing Piecesp. 96
The Infinite for Loopp. 97
Loops with No Bodyp. 98
Declaring Loop Control Variables Inside the for Loopp. 99
The while Loopp. 100
The do-while Loopp. 102
Improve the C++ Help Systemp. 105
Using break to Exit a Loopp. 108
Using continuep. 110
Finish the C++ Help Systemp. 111
Nested Loopsp. 115
Using the goto Statementp. 116
Module 3 Mastery Checkp. 117
Arrays, Strings, and Pointersp. 119
One-Dimensional Arraysp. 120
No Bounds Checkingp. 123
Two-Dimensional Arraysp. 124
Multidimensional Arraysp. 126
Sorting an Arrayp. 127
Stringsp. 129
String Fundamentalsp. 130
Reading a String from the Keyboardp. 130
Some String Library Functionsp. 132
strcpyp. 133
strcatp. 133
strcmpp. 133
strlenp. 133
A String Function Examplep. 134
Using the Null Terminatorp. 135
Array Initializationp. 136
Unsized Array Initializationsp. 140
Arrays of Stringsp. 141
Pointersp. 143
What Are Pointers?p. 143
The Pointer Operatorsp. 144
The Base Type of a Pointer Is Importantp. 146
Assigning Values Through a Pointerp. 147
Pointer Expressionsp. 148
Pointer Arithmeticp. 148
Pointer Comparisonsp. 150
Pointers and Arraysp. 151
Indexing a Pointerp. 153
String Constantsp. 155
Reversing a String in Placep. 156
Arrays of Pointersp. 159
The Null Pointer Conventionp. 160
Multiple Indirectionp. 161
Module 4 Mastery Checkp. 163
Introducing Functionsp. 165
Function Fundamentalsp. 166
The General Form of a Functionp. 166
Creating a Functionp. 167
Using Argumentsp. 168
Using returnp. 170
Returning Valuesp. 173
Using Functions in Expressionsp. 175
Scope Rulesp. 176
Local Scopep. 177
Global Scopep. 182
Passing Pointers and Arrays to Functionsp. 185
Passing a Pointerp. 185
Passing an Arrayp. 186
Passing Stringsp. 189
Returning Pointersp. 190
The main() Functionp. 192
Pass Command-Line Arguments to main()p. 192
Passing Numeric Command-Line Argumentsp. 194
Function Prototypesp. 196
Headers Contain Prototypesp. 198
Recursionp. 198
The Quicksortp. 201
Module 5 Mastery Checkp. 205
A Closer Look at Functionsp. 207
Two Approaches to Argument Passingp. 208
How C++ Passes Argumentsp. 208
Using a Pointer to Create a Call-by-Referencep. 209
Reference Parametersp. 211
Returning Referencesp. 216
Independent Referencesp. 219
A Few Restrictions When Using Referencesp. 220
Function Overloadingp. 221
Automatic Type Conversions and Overloadingp. 225
Create Overloaded Output Functionsp. 228
Default Function Argumentsp. 234
Default Arguments Versus Overloadingp. 235
Using Default Arguments Correctlyp. 237
Function Overloading and Ambiguityp. 238
Module 6 Mastery Checkp. 241
More Data Types and Operatorsp. 243
The const and volatile Qualifiersp. 244
constp. 244
volatilep. 246
Storage Class Specifiersp. 247
autop. 247
externp. 247
static Variablesp. 249
register Variablesp. 253
Enumerationsp. 256
typedefp. 259
Bitwise Operatorsp. 260
AND, OR, XOR, and NOTp. 261
The Shift Operatorsp. 266
Create Bitwise Rotation Functionsp. 269
The ? Operatorp. 274
The Comma Operatorp. 275
Multiple Assignmentsp. 277
Compound Assignmentp. 277
Using sizeofp. 278
Precedence Summaryp. 279
Module 7 Mastery Checkp. 280
Classes and Objectsp. 283
Class Fundamentalsp. 284
The General Form of a Classp. 284
Defining a Class and Creating Objectsp. 285
Adding Member Functions to a Classp. 289
Creating a Help Classp. 292
Constructors and Destructorsp. 298
Parameterized Constructorsp. 300
Adding a Constructor to the Vehicle Classp. 302
An Initialization Alternativep. 304
Inline Functionsp. 305
Creating Inline Functions Inside a Classp. 307
Creating a Queue Classp. 310
Arrays of Objectsp. 315
Initializing Object Arraysp. 316
Pointers to Objectsp. 318
Object Referencesp. 320
Module 8 Mastery Checkp. 320
A Closer Look at Classesp. 323
Overloading Constructorsp. 324
Assigning Objectsp. 325
Passing Objects to Functionsp. 327
Constructors, Destructors, and Passing Objectsp. 328
Passing Objects by Referencep. 330
A Potential Problem When Passing Objectsp. 332
Returning Objectsp. 332
Creating and Using a Copy Constructorp. 335
Friend Functionsp. 338
Structures and Unionsp. 343
Structuresp. 343
Unionsp. 345
The this Keywordp. 349
Operator Overloadingp. 351
Operator Overloading Using Member Functionsp. 352
Order Mattersp. 355
Using Member Functions to Overload Unary Operatorsp. 356
Nonmember Operator Functionsp. 361
Using a Friend to Overload a Unary Operatorp. 365
Operator Overloading Tips and Restrictionsp. 366
Creating a Set Classp. 368
Module 9 Mastery Checkp. 378
Inheritance, Virtual Functions, and Polymorphismp. 379
Inheritance Fundamentalsp. 380
Member Access and Inheritancep. 383
Base Class Access Controlp. 386
Using protected Membersp. 388
Constructors and Inheritancep. 391
Calling Base Class Constructorsp. 393
Extending the Vehicle Classp. 398
Creating a Multilevel Hierarchyp. 401
Inheriting Multiple Base Classesp. 404
When Constructor and Destructor Functions Are Executedp. 406
Pointers to Derived Typesp. 408
References to Derived Typesp. 409
Virtual Functions and Polymorphismp. 409
Virtual Function Fundamentalsp. 409
Virtual Functions Are Inheritedp. 412
Why Virtual Functions?p. 413
Applying Virtual Functionsp. 414
Pure Virtual Functions and Abstract Classesp. 419
Module 10 Mastery Checkp. 423
The C++ I/O Systemp. 425
Old vs. Modern C++ I/Op. 426
C++ Streamsp. 426
The C++ Predefined Streamsp. 427
The C++ Stream Classesp. 428
Overloading the I/O Operatorsp. 429
Creating Insertersp. 429
Using Friend Functions to Overload Insertersp. 431
Overloading Extractorsp. 432
Formatted I/Op. 434
Formatting with the ios Member Functionsp. 435
Using I/O Manipulatorsp. 440
Creating Your Own Manipulator Functionsp. 443
File I/Op. 446
Opening and Closing a Filep. 446
Reading and Writing Text Filesp. 448
Unformatted and Binary I/Op. 450
Reading and Writing Blocks of Datap. 453
More I/O Functionsp. 454
More Versions of get()p. 455
getline()p. 456
Detecting EOFp. 456
peek() and putback()p. 456
flush()p. 457
A File Comparison Utilityp. 457
Random Accessp. 461
Checking I/O Statusp. 464
Module 11 Mastery Checkp. 465
Exceptions, Templates, and Other Advanced Topicsp. 467
Exception Handlingp. 468
Exception Handling Fundamentalsp. 468
Using Multiple catch Statementsp. 473
Catching All Exceptionsp. 476
Specifying Exceptions Thrown by a Functionp. 477
Rethrowing an Exceptionp. 478
Templatesp. 480
Generic Functionsp. 481
A Function with Two Generic Typesp. 483
Explicitly Overloading a Generic Functionp. 483
Generic Classesp. 485
Explicit Class Specializationsp. 488
Creating a Generic Queue Classp. 490
Dynamic Allocationp. 494
Initializing Allocated Memoryp. 496
Allocating Arraysp. 497
Allocating Objectsp. 498
Namespacesp. 502
Namespace Fundamentalsp. 503
usingp. 506
Unnamed Namespacesp. 508
The std Namespacep. 509
static Class Membersp. 510
static Member Variablesp. 510
static Member Functionsp. 512
Runtime Type Identification (RTTI)p. 514
The Casting Operatorsp. 518
dynamic_castp. 518
const_castp. 519
static_castp. 520
reinterpret_castp. 520
What Next?p. 520
Module 12 Mastery Checkp. 521
The Preprocessorp. 523
#definep. 524
Function-Like Macrosp. 526
#errorp. 528
#includep. 528
Conditional Compilation Directivesp. 529
#if, #else, #elif, and #endifp. 529
#ifdef and #ifndefp. 531
#undefp. 532
Using definedp. 532
#linep. 533
#pragmap. 533
The # and ## Preprocessor Operatorsp. 534
Predefined Macro Namesp. 535
Working with an Older C++ Compilerp. 537
Two Simple Changesp. 539
Indexp. 541
Table of Contents provided by Ingram. All Rights Reserved.

ISBN: 9780072232158
ISBN-10: 0072232153
Series: Beginner's Guide
Audience: General
Format: Paperback
Language: English
Number Of Pages: 576
Published: 1st December 2003
Dimensions (cm): 23.3 x 18.8  x 2.9
Weight (kg): 0.94