- New Search
- » C++ primer
C++ primer
Author
Publisher
Addison-Wesley
Publication Date
Varies, see individual formats and editions
Language
English
Description
Loading Description...
Table of Contents
From the eBook - 4th ed.
Chapter 1. Getting Started
Writing a simple C++ program
Compiling and executing our program
A first look at input/output
Standard input and output objects
A program that uses the IO library
A word about comments
Control structures
The while statement
The for statement
The if statement
Reading an unknown number of inputs
Introducing classes
The sales_item class
A first look at member functions
The C++ program
Part I The Basics
Chapter 2. Variables and Basic Types
Primitive built-in types
Integral types
Floating-point types
Literal constants
Variables
What is a variable?
The name of a variable
Defining objects
Variable initialization rules
Declarations and definitions
Scope of a name
Define variables where they are used
const Qualifier
References
Typedef names
Enumerations
Class types
Writing our own header files
Designing our own headers
A brief introduction to the preprocessor
Chapter 3. Library Types
Namespace using declarations
Library string type
Defining and initializing strings
Reading and writing strings
Operations on strings
Dealing with the characters of a string
Library vectortype
Defining and initializing vectors
Operations on vectors
Introducing iterators
Iterator arithmetic
Library bitset type
Defining and initializing bitsets
Operations on bitsets
Chapter 4. Arrays and Pointers
Arrays
Defining and initializing arrays
Operations on arrays
Introducing pointers
What is a pointer?
Defining and initializing pointers
Operations on pointers
Using pointers to access array elements
Pointers and the const Qualifier
C-style character strings
Dynamically allocating arrays
Interfacing to older code
Multidimensional arrays
Pointers and multidimensioned arrays.; Chapter 5. Expressions
Arithmetic operators
Relational and logical operators
The bitwise operators
Using bitset objects or integral values
Using the bitwise operators for IO
Assignment operators
Assignment is right associative
Assignment has low precedence
Compound assignment operators
Increment and decrement operators
The arrow operator
The conditional operator
The sizeof operator
Comma operator
Evaluating compound expressions
Precedence
Associativity
Order of evaluation
The new and delete expressions
Type conversions
When implicit type conversions occur
The arithmetic conversions
Other implicit conversions
Explicit conversions
When casts might be useful
Named casts
Old-style casts
Chapter 6. Statements
Simple statements
Declaration statements
Compound statements (Blocks)
Statement scope
The if statement
The if statement else branch
The switch statement
Using a switch
Control flow within a switch
The default label
switch expression and case labels
Variable definitions inside a switch
The while statement
The for loop statement
Omitting parts of the for header
Multiple definitions in the for header
The do while statement
The break statement
The continue statement
The goto statement
try blocks and exception handling
A throw expression
The try block
Standard exceptions
Using the preprocessor for debugging
Chapter 7. Functions
Defining a function
Function return type
Function parameter list
Argument passing
Nonreference parameters
ReferenceParameters
vector and other container parameters
Array parameters
Managing arrays passed to functions
main:handling command-line options
Functions with varying parameters
The return statement
Functions with no return value
Functions that return a value
Recursion
Function declarations
Default arguments
Local Objects
Automatic objects
Static local objects
Inline functions
Class member functions
Defining the body of a member function
Defining a member function outside the class
Writing the sales_item constructor
Organizing class code files
Overloaded Functions
Overloading and scope
Function matching and argument conversions
The three steps in overload resolution
Argument-type conversions
Pointers to functions
Chapter 8. The IO Library
An object-oriented library
Condition states
Managing the output buffer
File input and output
Using file stream objects
File modes
A program to open and check input files
String streams.; Part II Containers and Algorithms
Chapter 9. Sequential Containers
Defining a sequential container
Initializing container elements
Constraints on types that a container can hold
Iterators and iterator ranges
Iterator ranges
Some container operations Invalidate iterators
Sequence container operations
Container typedefs
begin and end members
Adding elements to a sequential container
Relational Operators
Container size operations
Accessing elements
Erasing elements
Assignment and swap
How a vector grows
capacity and reserve members
Deciding which container to use
strings revisited
Other ways to construct strings
Other ways to change a string
string-only operations
string search operations
Comparing strings
Container adaptors
Stack adaptor
Queue and priority queue
Chapter 10. Associative Containers
Preliminaries: the pairtype
Associative containers
The map type
Defining a map
Types defined by map
Adding elements to a map
Subscripting a map
Using map::insert
Finding and retrieving a map element
Erasing elements from a map
Iterating across a map
A word transformation map
The set type
Defining and using sets
Building a word-exclusion set
The multimap and multiset types
Adding and removing elements
Finding elements in a multimap or multiset
Using containers: text-query program
Design of the query program
TextQuery class
Using the textQuery class
Writing the member functions
Chapter 11. Generic Algorithms
Overview
A first look at the algorithms
Read-only algorithms
Algorithms that write container elements
Algorithms that reorder container elements
Revisiting iterators
Insert iterators
iostream iterators
Reverse iterators
const iterators
The five categories
Structure of generic algorithms
Algorithm parameter patterns
Algorithm naming conventions
Containe-specific algorithms.; Part III Classes and Data Abstraction
Chapter 12. Classes
Class definitions and declarations
Class definitions: a recap
Data abstraction and encapsulation
More on class definitions
Class declarations versus definitions
Class objects
The implicit this pointer
Class scope
Name lookup in class scope
Constructors
The constructor initializer
Default arguments and constructors
The default constructor
Implicit class-type conversions
Explicit initialization of class members
Friends
static class members
static member functions
static data members.
Chapter 13. Copy Control
The copy constructor
The synthesized copy constructor
Defining our own copy constructor
Preventing copies
The assignment operator
The destructor
A message-handling example
Managing pointer members
Defining smart pointer classes
Defining valuelike classes
Chapter 14. Overloaded Operations and Conversions
Defining an overloaded operator
Overloaded operator design
Input and output operators
Overloading the output operator <<
Overloading the input operator>>
Arithmetic and relational operators
Equality operators
Relational operators
Assignment operators
Member access operators
Increment and decrement operators
Call operator and function objects
Using function objects with library algorithms
Library-defined function objects
Function adaptors for function objects
Conversions and class types
Why conversions are useful
Conversion operators
Argument matching and conversions
Overload resolution and class arguments
Overloading, conversions, and operators.; Part IV Object-Oriented and Generic Programming
Chapter 15. Object-oriented programming
OOP: an overview
Defining base and derived classes
Defining a base class
protected members
Derived Class
virtual and other member functions
Public, private, and protected inheritance
Friendship and inheritance
Inheritance and static members
Conversions and inheritance
Derived-to-base conversions
Conversions from base to derived
Constructors and copy control
Base-class constructors and copy control
Derived-class constructors
Copy control and inheritance
Virtual destructors
Virtuals in constructors and destructors
Class scope under inheritance
Name lookup happens at compile time
Name collisions and inheritance
Scope and member functions
Virtual functions and scope
Pure virtual functions
Containers and inheritance
Handle classes and inheritance
A pointerlike handle
Cloning an unknown type
Using the handle
Text queries revisited
An object-oriented solution
A valuelike handle
The query_base class
The query handle class
The derived classes
The eval functions
Chapter 16. Templates and Generic Programming
Template definitions
Defining a function template
Defining a class template
Template parameters
Template type parameters
Nontype template parameters
Writing generic programs
Instantiation
Template argument deduction
Function-template explicit arguments
Template compilation models
Class template members
Class-template member functions
Template arguments for nontype parameters
Friend declarations in class templates
Queue and queueItem friend declarations
Membertemplates
The complete queue class
static members of class templates
A generic handle class
Defining the handle class
Using the handle
Template specializations
Specializing a function template
Specializing a class template
Specializing members but not the class
Class-template partial specializations
Overloading and function templates.; Part V Advanced Topics
Chapter 17. Tools for Large Programs
Exception handling
Throwing an exception of class type
Stack unwinding
Catching an exception
Rethrow
The catch-all handler
Function try blocks and constructors
Exception class hierarchies
Automatic resource deallocation
The auto_ptr class
Exception specifications
Function pointer exception specifications
Namespaces
Namespace definitions
Nested namespaces
Unnamed namespaces
Using namespace members
Classes, namespaces, and scope
Overloading and namespaces
Namespaces and templates
Multiple and virtual inheritance
Multiple inheritance
Conversions and multiple base classes
Copy control for multiply derived classes
Class scope under multiple inheritance
Virtual inheritance
Virtual base class declaration
Special initialization semantics
Chapter 18. Specialized Tools and Techniques
Optimizing memory allocation
Memory allocation in C++
The allocator class
Operator new and delete functions
Placement new expressions
Explicit destructor invocation
Class specific new and delete
A memory-allocator base class
Run-time type identification
The dynamic_cast operator
The typeid operator
Using RTTI
The type_info class
Pointer to class member
Declaring a pointer to member
Using a pointer to class member
Nested classes
A nested class implementation
Name lookup in nested class scope
Union: a space-saving class
Local classes
Inherently nonportable features
Bit-fields
volatile Qualifier
Linkage directives: extern "C"
Appendix A The Library
A.1. Library names and headers
A.2. A brief tour of the algorithms
Algorithms to find an object
Other read-only algorithms
Binary-search algorithms
Algorithms that write container elements
Partitioning and sorting algorithms
General reordering operations
Permutation algorithms
Set algorithms for sorted sequences
Minimum and maximum values
NumericAlgorithms
A.3 The IO library revisited
Format state
Many manipulators change the format state
Controlling output formats
Controlling input formatting
Unformatted input/output operations
Single-byte operations
Multi-byte operations
Random access to a stream
Reading and writing to the same file.
Excerpt
Loading Excerpt...
Author Notes
Loading Author Notes...
More Details
Contributors
ISBN
9780201721485
9780321714114
9780133053036
9780133053043
9780321714114
9780133053036
9780133053043
Reviews from GoodReads
Loading GoodReads Reviews.
Staff View
Loading Staff View.