Cover image for C++ : a beginner's guide
Title:
C++ : a beginner's guide
Author:
Schildt, Herbert.
Personal Author:
Publication Information:
Berkeley, Calif. ; London : Osborne/McGraw-Hill, [2002]

©2002
Physical Description:
xxii, 632 pages : illustrations ; 24 cm.
General Note:
Includes index.

"219467-7"--Spine.
Language:
English
ISBN:
9780072194678
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Clarence Library QA76.73.C153 S315 2002 Adult Non-Fiction Computer Books
Searching...

On Order

Summary

Summary

More code is written in C++ than in any other existing programming language. This guide explains programming fundamentals and gives thorough coverage on all key aspects of C++, including data types, operators, arrays and functions.


Author Notes

Herb Schildt is the world's leading programming author


Table of Contents

Prefacep. xv
1 C# Fundamentalsp. 1
C#'s Family Treep. 2
C: The Beginning of the Modern Age of Programmingp. 2
The Creation of OOP and C++p. 3
The Internet and Java Emergep. 4
The Creation of C#p. 5
How C# Relates to the .NET Frameworkp. 7
What Is the .NET Framework?p. 7
How the Common Language Runtime Worksp. 8
Managed vs. Unmanaged Codep. 9
The Common Language Specificationp. 9
Object-Oriented Programmingp. 10
Encapsulationp. 11
Polymorphismp. 12
Inheritancep. 13
A First Simple Programp. 14
Using csc.exe, the C# Command-Line Compilerp. 15
Using the Visual C++ IDEp. 16
The First Sample Program Line by Linep. 21
Handling Syntax Errorsp. 25
A Small Variationp. 26
A Second Simple Programp. 27
Another Data Typep. 29
Project 1-1 Converting Fahrenheit to Celsiusp. 32
Two Control Statementsp. 33
The if Statementp. 34
The for Loopp. 36
Using Blocks of Codep. 38
Semicolons and Positioningp. 39
Indentation Practicesp. 40
Project 1-2 Improving the Temperature Conversion Programp. 41
The C# Keywordsp. 42
Identifiersp. 43
The C# Class Libraryp. 44
Mastery Checkp. 45
2 Introducing Data Types and Operatorsp. 47
Why Data Types Are Importantp. 48
C#'s Value Typesp. 48
Integersp. 49
Floating-Point Typesp. 52
The decimal Typep. 53
Charactersp. 54
The bool Typep. 56
Some Output Optionsp. 57
Project 2-1 Talking to Marsp. 60
Literalsp. 62
Hexadecimal Literalsp. 63
Character Escape Sequencesp. 63
String Literalsp. 64
A Closer Look at Variablesp. 67
Initializing a Variablep. 67
Dynamic Initializationp. 68
The Scope and Lifetime of Variablesp. 68
Operatorsp. 72
Arithmetic Operatorsp. 72
Increment and Decrementp. 74
Relational and Logical Operatorsp. 75
Short-Circuit Logical Operatorsp. 77
Project 2-2 Display a Truth Table for the Logical Operatorsp. 78
The Assignment Operatorp. 82
Compound Assignmentsp. 82
Type Conversion in Assignmentsp. 83
Casting Incompatible Typesp. 85
Operator Precedencep. 87
Expressionsp. 88
Type Conversion in Expressionsp. 88
Spacing and Parenthesesp. 92
Project 2-3 Compute the Regular Payments on a Loanp. 92
Mastery Checkp. 96
3 Program Control Statementsp. 99
Inputting Characters from the Keyboardp. 100
The if Statementp. 101
Nested ifsp. 103
The if-else-if Ladderp. 104
The switch Statementp. 106
Nested switch Statementsp. 111
Project 3-1 Start Building a C# Help Systemp. 112
The for Loopp. 115
Some Variations on the for Loopp. 117
Missing Piecesp. 118
Loops with No Bodyp. 120
Declaring Loop Control Variables Inside the for Loopp. 121
The while Loopp. 123
The do-while Loopp. 125
Project 3-2 Improve the C# Help Systemp. 128
Using break to Exit a Loopp. 131
Using continuep. 133
The gotop. 134
Project 3-3 Finish the C# Help Systemp. 136
Nested Loopsp. 141
Mastery Checkp. 143
4 Introducing Classes, Objects, and Methodsp. 145
Class Fundamentalsp. 146
The General Form of a Classp. 146
Defining a Classp. 148
How Objects Are Createdp. 153
Reference Variables and Assignmentp. 154
Methodsp. 155
Adding a Method to the Vehicle Classp. 156
Returning from a Methodp. 159
Returning a Valuep. 160
Using Parametersp. 163
Adding a Parameterized Method to Vehiclep. 165
Project 4-1 Creating a Help Classp. 167
Constructorsp. 174
Parameterized Constructorsp. 176
Adding a Constructor to the Vehicle Classp. 177
The new Operator Revisitedp. 179
Garbage Collection and Destructorsp. 180
Destructorsp. 181
Project 4-2 Demonstrate Destructorsp. 181
The this Keywordp. 184
Mastery Checkp. 187
5 More Data Types and Operatorsp. 189
Arraysp. 190
One-Dimensional Arraysp. 190
Project 5-1 Sorting an Arrayp. 196
Multidimensional Arraysp. 198
Two-Dimensional Arraysp. 198
Arrays of Three or More Dimensionsp. 200
Initializing Multidimensional Arraysp. 200
Jagged Arraysp. 202
Assigning Array Referencesp. 205
Using the Length Propertyp. 206
Project 5-2 A Queue Classp. 209
The foreach Loopp. 214
Stringsp. 217
Constructing Stringsp. 218
Operating on Stringsp. 218
Arrays of Stringsp. 221
Strings Are Immutablep. 222
The Bitwise Operatorsp. 224
The Bitwise AND, OR, XOR, and NOT Operatorsp. 224
The Shift Operatorsp. 230
Bitwise Compound Assignmentsp. 232
Project 5-3 A ShowBits Classp. 232
The ? Operatorp. 239
Mastery Checkp. 239
6 A Closer Look at Methods and Classesp. 241
Controlling Access to Class Membersp. 242
C#'s Access Specifiersp. 242
Project 6-1 Improving the Queue Classp. 248
Pass Objects to Methodsp. 250
How Arguments Are Passedp. 252
Using ref and out Parametersp. 255
Using refp. 255
Using outp. 257
Using a Variable Number of Argumentsp. 261
Returning Objectsp. 265
Method Overloadingp. 267
Overloading Constructorsp. 275
Invoking an Overloaded Constructor Through thisp. 277
Project 6-2 Overloading the Queue Constructorp. 279
The Main() Methodp. 283
Returning Values from Main()p. 283
Passing Arguments to Main()p. 283
Recursionp. 286
Understanding staticp. 289
Project 6-3 The Quicksortp. 293
Mastery Checkp. 297
7 Operator Overloading, Indexers, and Propertiesp. 299
Operator Overloadingp. 300
The General Forms of an Operator Methodp. 300
Overloading Binary Operatorsp. 301
Overloading Unary Operatorsp. 304
Adding Flexibilityp. 309
Overloading the Relational Operatorsp. 315
Operator Overloading Tips and Restrictionsp. 317
Indexersp. 319
Multidimensional Indexersp. 325
Propertiesp. 328
Property Restrictionsp. 333
Project 7-1 Creating a Set Classp. 333
Mastery Checkp. 344
8 Inheritancep. 345
Inheritance Basicsp. 346
Member Access and Inheritancep. 350
Using Protected Accessp. 353
Constructors and Inheritancep. 355
Calling Base Class Constructorsp. 357
Inheritance and Name Hidingp. 363
Using base to Access a Hidden Namep. 364
Project 8-1 Extending the Vehicle Classp. 367
Creating a Multilevel Hierarchyp. 371
When Are Constructors Called?p. 374
Base Class References and Derived Objectsp. 376
Virtual Methods and Overridingp. 382
Why Overridden Methods?p. 385
Applying Virtual Methodsp. 386
Using Abstract Classesp. 391
Using sealed to Prevent Inheritancep. 396
The object Classp. 396
Boxing and Unboxingp. 399
Mastery Checkp. 402
9 Interfaces, Structures, and Enumerationsp. 403
Interfacesp. 404
Implementing Interfacesp. 405
Using Interface Referencesp. 410
Project 9-1 Creating a Queue Interfacep. 413
Interface Propertiesp. 419
Interface Indexersp. 421
Interfaces Can Be Inheritedp. 424
Explicit Implementationsp. 426
Structuresp. 430
Enumerationsp. 432
Initialize an Enumerationp. 434
Specifying the Base Type of an Enumerationp. 435
Mastery Checkp. 436
10 Exception Handlingp. 437
The System.Exception Classp. 438
Exception Handling Fundamentalsp. 439
Using try and catchp. 439
A Simple Exception Examplep. 440
A Second Exception Examplep. 441
The Consequences of an Uncaught Exceptionp. 443
Exceptions Let You Handle Errors Gracefullyp. 445
Using Multiple catch Statementsp. 446
Catching All Exceptionsp. 448
Try Blocks Can Be Nestedp. 449
Throwing an Exceptionp. 450
Rethrowing an Exceptionp. 452
Using finallyp. 453
A Closer Look at Exceptionp. 455
Commonly Used Exceptionsp. 457
Deriving Exception Classesp. 458
Catching Derived Class Exceptionsp. 460
Project 10-1 Adding Exceptions to the Queue Classp. 462
Using checked and uncheckedp. 466
Mastery Checkp. 470
11 Using I/Op. 471
C#'s I/O Is Built upon Streamsp. 472
Byte Streams and Character Streamsp. 472
The Predefined Streamsp. 473
The Stream Classesp. 473
The Stream Classp. 474
The Byte Stream Classesp. 475
The Character Stream Wrapper Classesp. 475
Binary Streamsp. 477
Console I/Op. 478
Reading Console Inputp. 478
Writing Console Outputp. 480
FileStream and Byte-Oriented File I/Op. 481
Opening and Closing a Filep. 481
Reading Bytes from a FileStreamp. 483
Writing to a Filep. 485
Character-Based File I/Op. 488
Using StreamWriterp. 488
Using a StreamReaderp. 491
Redirecting the Standard Streamsp. 492
Project 11-1 A File Comparison Utilityp. 495
Reading and Writing Binary Datap. 497
BinaryWriterp. 498
BinaryReaderp. 499
Demonstrating Binary I/Op. 500
Random Access Filesp. 502
Converting Numeric Strings to Their Internal Representationp. 505
Project 11-2 Creating a Disk-Based Help Systemp. 511
Mastery Checkp. 518
12 Delegates, Events, Namespaces, and Advanced Topicsp. 519
Delegatesp. 520
Multicastingp. 525
Why Delegatesp. 528
Eventsp. 528
A Multicast Event Examplep. 531
Namespacesp. 535
Declaring a Namespacep. 535
Usingp. 538
A Second Form of usingp. 540
Namespaces Are Additivep. 542
Namespaces Can Be Nestedp. 544
The Default Namespacep. 545
Project 12-1 Putting Set into a Namespacep. 546
Conversion Operatorsp. 549
The Preprocessorp. 555
#definep. 555
#if and #endifp. 556
#else and #elifp. 558
#undefp. 560
#errorp. 561
#warningp. 561
#linep. 561
#region and #endregionp. 562
Attributesp. 562
The Conditional Attributep. 563
The Obsolete Attributep. 564
Unsafe Codep. 565
A Brief Look at Pointersp. 566
Using unsafep. 569
Using fixedp. 570
Runtime Type Identificationp. 571
Testing a Type with isp. 571
Using asp. 573
Using typeofp. 573
Other Keywordsp. 574
The internal Access Modifierp. 574
sizeofp. 574
lockp. 575
readonlyp. 575
stackallocp. 576
The using Statementp. 576
const and volatilep. 577
What Next?p. 577
Mastery Checkp. 578
A Answers to Mastery Checksp. 579
Module 1 C# Fundamentalsp. 580
Module 2 Introducing Data Types and Operatorsp. 581
Module 3 Program Control Statementsp. 583
Module 4 Introducing Classes, Objects, and Methodsp. 587
Module 5 More Data Types and Operatorsp. 588
Module 6 A Closer Look at Methods and Classesp. 591
Module 7 Operator Overloading, Indexers, and Propertiesp. 597
Module 8 Inheritancep. 599
Module 9 Interfaces, Structures, and Enumerationsp. 601
Module 10 Exception Handlingp. 605
Module 11 Using I/Op. 608
Module 12 Delegates, Events, Namespaces, and Advanced Topicsp. 611
Indexp. 613

Google Preview