大学计算机教育国外著名教材系列:C++完全参考手册(第4版)(影印版)

目 录内容简介
Part I The Foundation of C++: The C Subset
1 An Overview of C
The Origins and History of C
C Is a Middle-Level Language
C Is a Structured Language
C Is a Programmers Language
The Form of a C Program
The Library and Linking
Separate Compilation
Understanding the .C and .CPP File Extensions.
2 Expressions
The Five Basic Data Types
Modifying the Basic Types
Identifier Names
Variables
Where Variables Are Declared
Local Variables
Formal Parameters
Global Variables
The const and volatile Qualifiers
const
volatile
Storage Class Specifiers
extern
static Variables
register Variables
Variable Initializations
Constants
Hexadecimal and Octal Constants
String Constants
Backslash Character Constants
Operators
The Assignment Operator
Type Conversion in Assignments
Multiple Assignments
Arithmetic Operators
Increment and Decrement
Relational and Logical Operators
Bitwise Operators
The ? Operator
The & and * Pointer Operators
The Compile-Time Operator sizeof
The Comma Operator
The Dot (.) and Arrow (->) Operators
The [ ] and ( ) Operators
Precedence Summary
Expressions
Order of Evaluation
Type Conversion in Expressions
Casts
Spacing and Parentheses
Compound Assignments
3 Statements
True and False in C and C++
Selection Statements
if
Nested ifs
The if-else-if Ladder
The ? Alternative
The Conditional Expression
switch
Nested switch Statements
Iteration Statements
The for Loop
for Loop Variations
The Infinite Loop
for Loops with No Bodies
The while Loop
The do-while Loop
Declaring Variables Within Selection and Iteration Statements
Jump Statements
The return Statement
The goto Statement
The break Statement
The exit( ) Function
The continue Statement
Expression Statements
Block Statements
4 Arrays and Null-Terminated Strings
Single-Dimension Arrays
Generating a Pointer to an Array
Passing Single-Dimension Arrays to Functions
Null-Terminated Strings
Two-Dimensional Arrays
Arrays of Strings
Multidimensional Arrays
Indexing Pointers
Array Initialization
Unsized Array Initializations
A Tic-Tac-Toe Example
5 Pointers
What Are Pointers?
Pointer Variables
The Pointer Operators
Pointer Expressions
Pointer Assignments
Pointer Arithmetic
Pointer Comparisons
Pointers and Arrays
Arrays of Pointers
Multiple Indirection
Initializing Pointers
Pointers to Functions
Cs Dynamic Allocation Functions
Problems with Pointers
6 Functions
The General Form of a Function
Scope Rules of Functions
Function Arguments
Call by Value, Call by Reference
Creating a Call by Reference
Calling Functions with Arrays
argc and argv——Arguments to main( )
The return Statement
Returning from a Function
Returning Values
Returning Pointers
Functions of Type void
What Does main( ) Return?
Recursion
Function Prototypes
Standard Library Function Prototypes
Declaring Variable-Length Parameter Lists
Old-Style Versus Modern FunctionParameter Declarations ...
7 Structures, Unions, Enumerations,
and User-Defined Types
Structures
Accessing Structure Members
Structure Assignments
Arrays of Structures
Passing Structures to Functions
Passing Structure Members to Functions
Passing Entire Structures to Functions
Structure Pointers
Declaring a Structure Pointer
Using Structure Pointers
Arrays and Structures Within Structures
Bit-Fields
Unions
Enumerations
Using sizeof to Ensure Portability
typedef
8 C-Style Console I/O
An Important Application Note
Reading and Writing Characters
A Problem with getchar( )
Alternatives to getchar( )
Reading and Writing Strings
Formatted Console I/O
printf( )
Printing Characters
Printing Numbers
Displaying an Address
The %n Specifier
Format Modifiers
The Minimum Field Width Specifier
The Precision Specifier
Justifying Output
Handling Other Data Types
The * and # Modifiers
scanf( )
Format Specifiers
Inputting Numbers
Inputting Unsigned Integers
Reading Individual Characters Using scanf( )
Reading Strings
Inputting an Address
The %n Specifier
Using a Scanset
Discarding Unwanted White Space
Non-White-Space Characters in the Control String
You Must Pass scanf( ) Addresses
Format Modifiers
Suppressing Input
9 File I/O
C Versus C++ File I/O
Streams and Files
Streams
Text Streams
Binary Streams
Files
File System Basics
The File Pointer
Opening a File
Closing a File
Writing a Character
Reading a Character
Using fopen(), getc(), putc(), and fclose( )
Using feof( )
Working with Strings: fputs( ) and fgets( )
rewind( )
ferror( )
Erasing Files
Flushing a Stream
fread( ) and fwrite( )
Using fread( ) and fwrite( )
fseek( ) and Random-Access I/O
fprintf( ) and fscanf( )
The Standard Streams
The Console I/0 Connection
Using freopen( )to Redirect the Standard Streams
10 The Preprocessor and Comments
The Preprocessor
#define
Defining Function-like Macros
#error
#include
Conditional Compilation Directives
#if, #else, #elif, and #endif
#ifdef and #ifndef
#undef
Using defined
#line
#pragma
The # and ## Preprocessor Operators
Predefined Macro Names
Comments
Single-Line Comments
Part II C++
11 An Overview of C++
The Origins of C++
What Is Object-Oriented Programming?
Encapsulation
Polymorphism
Inheritance
Some C++ Fundamentals
A Sample C++ Program
A Closer Look at the I/O Operators
Declaring Local Variables
No Default to int
The bool Data Type
Old-Style vs. Modern C++
The New C++ Headers
Namespaces
Working with an Old Compiler
Introducing C++ Classes
Function Overloading
Operator Overloading
Inheritance
Constructors and Destructors
The C++ Keywords
The General Form of a C++ Program
12 Classes and Objects
Classes
Structures and Classes Are Related
Unions and Classes Are Related
Anonymous Unions
Friend Functions
Friend Classes
Inline Functions
Defining Inline Functions Within a Class
Parameterized Constructors
Constructors with One Parameter: A Special Case .,
Static Class Members
Static Data Members
Static Member Functions
When Constructors and Destructors Are Executed
The Scope Resolution Operator
Nested Classes
Local Classes
Passing Objects to Functions
Returning Objects
Object Assignment
13 Arrays, Pointers, References, and the Dynamic
Allocation Operators
Arrays of Objects
Creating Initialized vs. Uninitialized Arrays
Pointers to Objects
Type Checking C++ Pointers
The this Pointer
Pointers to Derived Types
Pointers to Class Members
References
Reference Parameters
Passing References to Objects-
Returning References
Independent References
References to Derived Types
Restrictions to References
A Matter of Style
C++s Dynamic Allocation Operators
Initializing Allocated Memory
Allocating Arrays
Allocating Objects
The nothrow Alternative
The Placement Form of new
14 Function Overloading, Copy Constructors,
and Default Arguments
Function Overloading
Overloading Constructors
Overloading a Constructor to Gain Flexibility
Allowing Both Initialized and Uninitialized Objects
Copy Constructors
Finding the Address of an Overloaded Function
The overload Anachronism
Default Function Arguments
Default Arguments vs. Overloading
Using Default Arguments Correctly
Function Overloading and Ambiguity
15 Operator Overloading
Creating a Member Operator Function
Creating Prefix and Postfix Forms
of the Increment and Decrement Operators
Overloading the Shorthand Operators
Operator Overloading Restrictions
Operator Overloading Using a Friend Function
Using a Friend to Overload ++ or ——
Friend Operator Functions Add Flexibility
Overloading new and delete
Overloading new and delete for Arrays
Overloading the nothrow Version of new and delete
Overloading Some Special Operators
Overloading [ ]
Overloading ( )
Overloading ->
Overloading the Comma Operator
16 Inheritance
Base-Class Access Control
Inheritance and protected Members
Protected Base-Class Inheritance
Inheriting Multiple Base Classes
Constructors, Destructors, and Inheritance
When Constructors and Destructors Are Executed
Passing Parameters to Base-Class Constructors
Granting Access
Virtual Base Classes
17 Virtual Functions and Polymorphism
Virtual Functions
Calling a Virtual Function Through a Base
Class Reference
The Virtual Attribute Is Inherited
Virtual Functions Are Hierarchical
Pure Virtual Functions
Abstract Classes
Using Virtual Functions
Early vs. Late Binding
18 Templates
Generic Functions
A Function with Two Generic Types
Explicitly Overloading a Generic Function
Overloading a Function Template
Using Standard Parameters with Template Functions
Generic Function Restrictions
Applying Generic Functions
A Generic Sort
Compacting an Array
Generic Classes
An Example with Two Generic Data Types
Applying Template Classes: A Generic Array Class
Using Non-Type Arguments with Generic Classes
Using Default Arguments with Template Classes
Explicit Class Specializations
The typename and export Keywords
The Power of Templates
19 Exception Handling
Exception Handling Fundamentals
Catching Class Types
Using Multiple catch Statements
Handling Derived-Class Exceptions
Exception Handling Options
Catching All Exceptions
Restricting Exceptions
Rethrowing an Exception
Understanding terminate( ) and unexpected( )
Setting the Terminate and Unexpected Handlers
The uncaught_exception( ) Function
The exception and bad_exception Classes
Applying Exception Handling
20 The C++ I/O System Basics
Old vs. Modern C++ I/O
C++ Streams
The C++ Stream Classes
C++s Predefined Streams
Formatted I/O
Formatting Using the ios Members
Setting the Format Flags
Clearing Format Flags
An Overloaded Form of setf( )
Examining the Formatting Flags
Setting All Flags
Using width(), precision(), and fill( )
Using Manipulators to Format I/O
Overloading
Creating Your Own Inserters
Creating Your Own Extractors
Creating Your Own Manipulator Functions
21 C++ File I/O
and the File Classes
Opening and Closing a File
Reading and Writing Text Files
Unformatted and Binary I/O
Characters vs. Bytes
put( ) and get( )
read( ) and write( )
More get( ) Functions
getline( )
Detecting EOF
The ignore( ) Function
peek( ) and putback( )
flush( )
Random Access
Obtaining the Current File Position
I/O Status
Customized I/O and Files
22 Run-Time Type ID and the Casting Operators
Run-Time Type Identification (RTTI)
The Casting Operators
dynamic_cast
23 Namespaces, Conversion Functions,
and Other Advanced Topics
Namespaces
Namespace Fundamentals
using
Unnamed Namespaces
Some Namespace Options
The std Namespace
Creating Conversion Functions
const Member Functions and mutable
Volatile Member Functions
Explicit Constructors
The Member Initialization Syntax
Using the asm Keyword
Linkage Specification
Array-Based I/O
The Array-Based Classes
Creating an Array-Based Output Stream
Using an Array as Input
Input/Output Array-Based Streams
Using Dynamic Arrays
Using Binary I/O with Array-Based Streams
Summarizing the Differences Between C and C++
24 Introducing the Standard Template Library
An Overview of the STL
Containers
Algorithms
Iterators
Other STL Elements
The Container Classes
General Theory of Operation
Vectors
Accessing a Vector Through an Iterator
Inserting and Deleting Elements in a Vector
Storing Class Objects in a Vector
Lists
Understanding end( )
push_front( ) vs. push_back( )
Sort a List
Merging One List with Another
Storing Class Objects in a List
Maps
Storing Class Objects in a Map
Algorithms
Counting
Removing and Replacing Elements
Reversing a Sequence
Transforming a Sequence
Using Function Objects
Unary and Binary Function Objects
Using the Built-in Function Objects
Creating a Function Object
Using Binders
The string Class
Some string Member Functions
Strings Are Containers
Putting Strings into Other Containers
Final Thoughts on the STL
1 An Overview of C
The Origins and History of C
C Is a Middle-Level Language
C Is a Structured Language
C Is a Programmers Language
The Form of a C Program
The Library and Linking
Separate Compilation
Understanding the .C and .CPP File Extensions.
2 Expressions
The Five Basic Data Types
Modifying the Basic Types
Identifier Names
Variables
Where Variables Are Declared
Local Variables
Formal Parameters
Global Variables
The const and volatile Qualifiers
const
volatile
Storage Class Specifiers
extern
static Variables
register Variables
Variable Initializations
Constants
Hexadecimal and Octal Constants
String Constants
Backslash Character Constants
Operators
The Assignment Operator
Type Conversion in Assignments
Multiple Assignments
Arithmetic Operators
Increment and Decrement
Relational and Logical Operators
Bitwise Operators
The ? Operator
The & and * Pointer Operators
The Compile-Time Operator sizeof
The Comma Operator
The Dot (.) and Arrow (->) Operators
The [ ] and ( ) Operators
Precedence Summary
Expressions
Order of Evaluation
Type Conversion in Expressions
Casts
Spacing and Parentheses
Compound Assignments
3 Statements
True and False in C and C++
Selection Statements
if
Nested ifs
The if-else-if Ladder
The ? Alternative
The Conditional Expression
switch
Nested switch Statements
Iteration Statements
The for Loop
for Loop Variations
The Infinite Loop
for Loops with No Bodies
The while Loop
The do-while Loop
Declaring Variables Within Selection and Iteration Statements
Jump Statements
The return Statement
The goto Statement
The break Statement
The exit( ) Function
The continue Statement
Expression Statements
Block Statements
4 Arrays and Null-Terminated Strings
Single-Dimension Arrays
Generating a Pointer to an Array
Passing Single-Dimension Arrays to Functions
Null-Terminated Strings
Two-Dimensional Arrays
Arrays of Strings
Multidimensional Arrays
Indexing Pointers
Array Initialization
Unsized Array Initializations
A Tic-Tac-Toe Example
5 Pointers
What Are Pointers?
Pointer Variables
The Pointer Operators
Pointer Expressions
Pointer Assignments
Pointer Arithmetic
Pointer Comparisons
Pointers and Arrays
Arrays of Pointers
Multiple Indirection
Initializing Pointers
Pointers to Functions
Cs Dynamic Allocation Functions
Problems with Pointers
6 Functions
The General Form of a Function
Scope Rules of Functions
Function Arguments
Call by Value, Call by Reference
Creating a Call by Reference
Calling Functions with Arrays
argc and argv——Arguments to main( )
The return Statement
Returning from a Function
Returning Values
Returning Pointers
Functions of Type void
What Does main( ) Return?
Recursion
Function Prototypes
Standard Library Function Prototypes
Declaring Variable-Length Parameter Lists
Old-Style Versus Modern FunctionParameter Declarations ...
7 Structures, Unions, Enumerations,
and User-Defined Types
Structures
Accessing Structure Members
Structure Assignments
Arrays of Structures
Passing Structures to Functions
Passing Structure Members to Functions
Passing Entire Structures to Functions
Structure Pointers
Declaring a Structure Pointer
Using Structure Pointers
Arrays and Structures Within Structures
Bit-Fields
Unions
Enumerations
Using sizeof to Ensure Portability
typedef
8 C-Style Console I/O
An Important Application Note
Reading and Writing Characters
A Problem with getchar( )
Alternatives to getchar( )
Reading and Writing Strings
Formatted Console I/O
printf( )
Printing Characters
Printing Numbers
Displaying an Address
The %n Specifier
Format Modifiers
The Minimum Field Width Specifier
The Precision Specifier
Justifying Output
Handling Other Data Types
The * and # Modifiers
scanf( )
Format Specifiers
Inputting Numbers
Inputting Unsigned Integers
Reading Individual Characters Using scanf( )
Reading Strings
Inputting an Address
The %n Specifier
Using a Scanset
Discarding Unwanted White Space
Non-White-Space Characters in the Control String
You Must Pass scanf( ) Addresses
Format Modifiers
Suppressing Input
9 File I/O
C Versus C++ File I/O
Streams and Files
Streams
Text Streams
Binary Streams
Files
File System Basics
The File Pointer
Opening a File
Closing a File
Writing a Character
Reading a Character
Using fopen(), getc(), putc(), and fclose( )
Using feof( )
Working with Strings: fputs( ) and fgets( )
rewind( )
ferror( )
Erasing Files
Flushing a Stream
fread( ) and fwrite( )
Using fread( ) and fwrite( )
fseek( ) and Random-Access I/O
fprintf( ) and fscanf( )
The Standard Streams
The Console I/0 Connection
Using freopen( )to Redirect the Standard Streams
10 The Preprocessor and Comments
The Preprocessor
#define
Defining Function-like Macros
#error
#include
Conditional Compilation Directives
#if, #else, #elif, and #endif
#ifdef and #ifndef
#undef
Using defined
#line
#pragma
The # and ## Preprocessor Operators
Predefined Macro Names
Comments
Single-Line Comments
Part II C++
11 An Overview of C++
The Origins of C++
What Is Object-Oriented Programming?
Encapsulation
Polymorphism
Inheritance
Some C++ Fundamentals
A Sample C++ Program
A Closer Look at the I/O Operators
Declaring Local Variables
No Default to int
The bool Data Type
Old-Style vs. Modern C++
The New C++ Headers
Namespaces
Working with an Old Compiler
Introducing C++ Classes
Function Overloading
Operator Overloading
Inheritance
Constructors and Destructors
The C++ Keywords
The General Form of a C++ Program
12 Classes and Objects
Classes
Structures and Classes Are Related
Unions and Classes Are Related
Anonymous Unions
Friend Functions
Friend Classes
Inline Functions
Defining Inline Functions Within a Class
Parameterized Constructors
Constructors with One Parameter: A Special Case .,
Static Class Members
Static Data Members
Static Member Functions
When Constructors and Destructors Are Executed
The Scope Resolution Operator
Nested Classes
Local Classes
Passing Objects to Functions
Returning Objects
Object Assignment
13 Arrays, Pointers, References, and the Dynamic
Allocation Operators
Arrays of Objects
Creating Initialized vs. Uninitialized Arrays
Pointers to Objects
Type Checking C++ Pointers
The this Pointer
Pointers to Derived Types
Pointers to Class Members
References
Reference Parameters
Passing References to Objects-
Returning References
Independent References
References to Derived Types
Restrictions to References
A Matter of Style
C++s Dynamic Allocation Operators
Initializing Allocated Memory
Allocating Arrays
Allocating Objects
The nothrow Alternative
The Placement Form of new
14 Function Overloading, Copy Constructors,
and Default Arguments
Function Overloading
Overloading Constructors
Overloading a Constructor to Gain Flexibility
Allowing Both Initialized and Uninitialized Objects
Copy Constructors
Finding the Address of an Overloaded Function
The overload Anachronism
Default Function Arguments
Default Arguments vs. Overloading
Using Default Arguments Correctly
Function Overloading and Ambiguity
15 Operator Overloading
Creating a Member Operator Function
Creating Prefix and Postfix Forms
of the Increment and Decrement Operators
Overloading the Shorthand Operators
Operator Overloading Restrictions
Operator Overloading Using a Friend Function
Using a Friend to Overload ++ or ——
Friend Operator Functions Add Flexibility
Overloading new and delete
Overloading new and delete for Arrays
Overloading the nothrow Version of new and delete
Overloading Some Special Operators
Overloading [ ]
Overloading ( )
Overloading ->
Overloading the Comma Operator
16 Inheritance
Base-Class Access Control
Inheritance and protected Members
Protected Base-Class Inheritance
Inheriting Multiple Base Classes
Constructors, Destructors, and Inheritance
When Constructors and Destructors Are Executed
Passing Parameters to Base-Class Constructors
Granting Access
Virtual Base Classes
17 Virtual Functions and Polymorphism
Virtual Functions
Calling a Virtual Function Through a Base
Class Reference
The Virtual Attribute Is Inherited
Virtual Functions Are Hierarchical
Pure Virtual Functions
Abstract Classes
Using Virtual Functions
Early vs. Late Binding
18 Templates
Generic Functions
A Function with Two Generic Types
Explicitly Overloading a Generic Function
Overloading a Function Template
Using Standard Parameters with Template Functions
Generic Function Restrictions
Applying Generic Functions
A Generic Sort
Compacting an Array
Generic Classes
An Example with Two Generic Data Types
Applying Template Classes: A Generic Array Class
Using Non-Type Arguments with Generic Classes
Using Default Arguments with Template Classes
Explicit Class Specializations
The typename and export Keywords
The Power of Templates
19 Exception Handling
Exception Handling Fundamentals
Catching Class Types
Using Multiple catch Statements
Handling Derived-Class Exceptions
Exception Handling Options
Catching All Exceptions
Restricting Exceptions
Rethrowing an Exception
Understanding terminate( ) and unexpected( )
Setting the Terminate and Unexpected Handlers
The uncaught_exception( ) Function
The exception and bad_exception Classes
Applying Exception Handling
20 The C++ I/O System Basics
Old vs. Modern C++ I/O
C++ Streams
The C++ Stream Classes
C++s Predefined Streams
Formatted I/O
Formatting Using the ios Members
Setting the Format Flags
Clearing Format Flags
An Overloaded Form of setf( )
Examining the Formatting Flags
Setting All Flags
Using width(), precision(), and fill( )
Using Manipulators to Format I/O
Overloading
Creating Your Own Inserters
Creating Your Own Extractors
Creating Your Own Manipulator Functions
21 C++ File I/O
and the File Classes
Opening and Closing a File
Reading and Writing Text Files
Unformatted and Binary I/O
Characters vs. Bytes
put( ) and get( )
read( ) and write( )
More get( ) Functions
getline( )
Detecting EOF
The ignore( ) Function
peek( ) and putback( )
flush( )
Random Access
Obtaining the Current File Position
I/O Status
Customized I/O and Files
22 Run-Time Type ID and the Casting Operators
Run-Time Type Identification (RTTI)
The Casting Operators
dynamic_cast
23 Namespaces, Conversion Functions,
and Other Advanced Topics
Namespaces
Namespace Fundamentals
using
Unnamed Namespaces
Some Namespace Options
The std Namespace
Creating Conversion Functions
const Member Functions and mutable
Volatile Member Functions
Explicit Constructors
The Member Initialization Syntax
Using the asm Keyword
Linkage Specification
Array-Based I/O
The Array-Based Classes
Creating an Array-Based Output Stream
Using an Array as Input
Input/Output Array-Based Streams
Using Dynamic Arrays
Using Binary I/O with Array-Based Streams
Summarizing the Differences Between C and C++
24 Introducing the Standard Template Library
An Overview of the STL
Containers
Algorithms
Iterators
Other STL Elements
The Container Classes
General Theory of Operation
Vectors
Accessing a Vector Through an Iterator
Inserting and Deleting Elements in a Vector
Storing Class Objects in a Vector
Lists
Understanding end( )
push_front( ) vs. push_back( )
Sort a List
Merging One List with Another
Storing Class Objects in a List
Maps
Storing Class Objects in a Map
Algorithms
Counting
Removing and Replacing Elements
Reversing a Sequence
Transforming a Sequence
Using Function Objects
Unary and Binary Function Objects
Using the Built-in Function Objects
Creating a Function Object
Using Binders
The string Class
Some string Member Functions
Strings Are Containers
Putting Strings into Other Containers
Final Thoughts on the STL
目 录内容简介
《C++完全参考手册》作者Herbert Schildt是程序设计语言的大师,其著作涉及C、C++、Java和C# 等语言。
《C++完全参考手册》以一种清晰而易懂的方式,全面介绍了C++语言的各个方面,如关键字、语法、函数、类和库,以及一些C++的高级特性,如重载、继承、虚拟函数、命名空间、模板、RTTI(运行时类型信息)以及STL(标准模板库)等。读者不仅可以从《C++完全参考手册》中学习到程序设计所需的语言知识,而且还可了解如何进行程序设计。
《C++完全参考手册》适合作为C++语言的教学用书。《C++完全参考手册》介绍的内容适用于所有现代编程环境,适合于各种水平的C++程序设计人员,既可以作为帮助初学者解答特定问题的参考指南,也可以让C++编程高手从中发现许多有用功能的深入介绍。
《C++完全参考手册》以一种清晰而易懂的方式,全面介绍了C++语言的各个方面,如关键字、语法、函数、类和库,以及一些C++的高级特性,如重载、继承、虚拟函数、命名空间、模板、RTTI(运行时类型信息)以及STL(标准模板库)等。读者不仅可以从《C++完全参考手册》中学习到程序设计所需的语言知识,而且还可了解如何进行程序设计。
《C++完全参考手册》适合作为C++语言的教学用书。《C++完全参考手册》介绍的内容适用于所有现代编程环境,适合于各种水平的C++程序设计人员,既可以作为帮助初学者解答特定问题的参考指南,也可以让C++编程高手从中发现许多有用功能的深入介绍。
比价列表
公众号、微信群

微信公众号

实时获取购书优惠