万本电子书0元读

万本电子书0元读

顶部广告

Beginning C++ Programming电子书

售       价:¥

15人正在读 | 0人评论 9.8

作       者:Richard Grimes

出  版  社:Packt Publishing

出版时间:2017-04-24

字       数:79.6万

所属分类: 进口书 > 外文原版书 > 电脑/网络

温馨提示:此类商品不支持退换货,不支持下载打印

为你推荐

  • 读书简介
  • 目录
  • 累计评论(0条)
  • 读书简介
  • 目录
  • 累计评论(0条)
C++ has come a long way and is now adopted in several contexts. Its key strengths are its software infrastructure and resource-constrained applications, including desktop applications, servers, and performance-critical applications, not to forget its importance in game programming. Despite its strengths in these areas, beginners usually tend to shy away from learning the language because of its steep learning curve. The main mission of this book is to make you familiar and comfortable with C++. You will finish the book not only being able to write your own code, but more importantly, you will be able to read other projects. It is only by being able to read others' code that you will progress from a beginner to an advanced programmer. This book is the first step in that progression. The first task is to familiarize you with the structure of C++ projects so you will know how to start reading a project. Next, you will be able to identify the main structures in the language, functions, and classes, and feel confident being able to identify the execution flow through the code. You will then become aware of the facilities of the standard library and be able to determine whether you need to write a routine yourself, or use an existing routine in the standard library. Throughout the book, there is a big emphasis on memory and pointers. You will understand memory usage, allocation, and
目录展开

Title Page

Copyright

Credits

About the Author

About the Reviewer

www.PacktPub.com

Customer Feedback

Preface

What this book covers

What you need for this book

Who this book is for

Conventions

Reader feedback

Customer support

Downloading the example code

Downloading the color images of this book

Errata

Piracy

Questions

Starting with C++

What will you find in this chapter?

What is C++?

Installing Visual C++

Setting up

Downloading the installation files

Installing Visual Studio

Registering with Microsoft

Examining C++ projects

Compilers

Linking the code

Source files

A simple example

Creating source files

Compiling the code

Passing parameters between the command-line and an executable

The preprocessor and symbols

Defining constants

Using macros

Using symbols

Using pragmas

Dependencies

Libraries

Pre-compiled headers

Project structure

Managing dependencies

Makefiles

Writing a simple project

The project structure

Creating the precompiled header

Creating the main file

Using input and output streams

Using time functions

Building the executable

Testing the code

Changing the project

Summary

Understanding Language Features

Writing C++

Using white space

Formatting code

Writing statements

Working with expressions

Using the comma operator

Using types and variables

Using constants and literals

Defining constants

Using constant expressions

Using enumerations

Declaring pointers

Using namespaces

C++ scoping of variables

Using operators

Exploring the built-in operators

Arithmetic operators

Increment and decrement operators

Bitwise operators

Boolean operators

Bitwise shift operators

Assignment operators

Controlling execution flow

Using conditional statements

Selecting

Looping

Looping with iteration

Conditional loops

Jumping

Using C++ language features

Summary

Exploring C++ Types

Exploring built-in types

Integers

Specifying integer literals

Using bitset to show bit patterns

Determining integer byte order

Floating point types

Specifying floating point literals

Characters and strings

Character types

Using character macros

Specifying character literals

Specifying string literals

Unicode literals

Raw strings

String byte order

Boolean

void

Initializers

Default values

Declarations without a type

Storage classes

Using type aliases

Aggregating data in record types

Structures

Initializing

Structure fields

Using structure names

Determining alignment

Storing data in the same memory with unions

Accessing runtime type information

Determining type limits

Converting between types

Type conversions

Promoting conversions

Narrowing conversions

Narrowing to bool

Converting signed types

Casting

Casting away const-ness

Casting without runtime checks

Casting pointers without runtime checks

Casting with runtime checks

Casting with list initializer

Using C casts

Using C++ types

Summary

Working with Memory, Arrays, and Pointers

Using memory in C++

Using C++ pointer syntax

Using null pointers

Types of memory

Pointer arithmetic

Using arrays

Function parameters

Multidimensional arrays

Passing multidimensional arrays to functions

Using arrays of characters

Comparing strings

Preventing buffer overruns

Using pointers in C++

Accessing out of bounds

Pointers to deallocated memory

Converting pointers

Constant pointers

Changing the type pointed to

Allocating memory in code

Allocating individual objects

Allocating arrays of objects

Handling failed allocations

Using other versions of the new operator

Memory lifetime

The Windows SDK and pointers

Memory and the C++ Standard Library

Standard Library arrays

Using the stack-based array class

Using the dynamically allocated vector class

References

Constant references

Returning references

Temporaries and references

The rvalue references

Ranged for and references

Using pointers in practice

Creating the project

Adding a task object to the list

Deleting the task list

Iterating the task list

Inserting items

Summary

Using Functions

Defining C++ functions

Declaring and defining functions

Specifying linkage

Inlining

Determining the return type

Naming the function

Function parameters

Specifying exceptions

Function body

Using function parameters

Passing Initializer lists

Using default parameters

Variable number of parameters

Initializer lists

Argument lists

Function features

Call stack

Specifying calling conventions

Using C linkage

Specifying how the stack Is maintained

Using recursion

Overloading functions

Functions and scope

Deleted functions

Passing by value and passing by reference

Designing functions

Pre- and post-conditions

Using invariants

Function pointers

Remember the parentheses!

Declaring function pointers

Using function pointers

Templated functions

Defining templates

Using template parameter values

Specialized templates

Variadic templates

Overloaded operators

Function objects

Introducing lambda expressions

Using functions in C++

Summary

Classes

Writing classes

Reviewing structures

Defining classes

Defining class behavior

Using the this pointer

Using the scope resolution operator

Defining class state

Creating objects

Construction of objects

Defining constructors

Delegating constructors

Copy constructor

Converting between types

Making friends

Marking constructors as explicit

Destructing objects

Assigning objects

Move semantics

Declaring static members

Defining static members

Using static and global objects

Named constructors

Nested classes

Accessing const objects

Using objects with pointers

Getting pointers to object members

Operator overloading

Defining function classes

Defining conversion operators

Managing resources

Writing wrapper classes

Using smart pointers

Managing exclusive ownership

Sharing ownership

Handling dangling pointers

Templates

Using classes

Summary

Introduction to Object-Orientated Programming

Inheritance and composition

Inheriting from a class

Overriding methods and hiding names

Using pointers and references

Access levels

Changing access level through inheritance

Inheritance access levels

Multiple inheritance

Object slicing

Introducing polymorphism

Virtual methods

Virtual method tables

Multiple inheritance and virtual method tables

Virtual methods, construction, and destruction

Containers and virtual methods

Friends and inheritance

Override and final

Virtual inheritance

Abstract classes

Obtaining type information

Smart pointers and virtual methods

Interfaces

Class relationships

Using mixin classes

Using polymorphism

Summary

Using the Standard Library Containers

Working with pairs and tuples

Containers

Sequence containers

List

Forward list

Vector

Deque

Associative containers

Maps and multimaps

Sets and multisets

Unordered containers

Special purpose containers

Using iterators

Input and output iterators

Stream iterators

Using iterators with the C Standard Library

Algorithms

Iteration of items

Getting information

Comparing containers

Changing Items

Finding Items

Sorting items

Using the numeric libraries

Compile time arithmetic

Complex numbers

Using the Standard Library

Summary

Using Strings

Using the string class as a container

Getting information about a string

Altering strings

Searching strings

Internationalization

Using facets

Strings and numbers

Converting strings to numbers

Converting numbers to strings

Using stream classes

Outputting floating point numbers

Outputting integers

Outputting time and money

Converting numbers to strings using streams

Reading numbers from strings using streams

Using regular expressions

Defining regular expressions

Standard Library classes

Matching expressions

Using iterators

Replacing strings

Using strings

Creating the project

Processing header subitems

Summary

Diagnostics and Debugging

Preparing your code

Invariants and conditions

Conditional compilation

Using pragmas

Adding informational messages

Compiler switches for debugging

Pre-processor symbols

Producing diagnostic messages

Trace messages with the C runtime

Tracing messages with Windows

Using asserts

Application termination

Error values

Obtaining message descriptions

Using the Message Compiler

C++ exceptions

Exception specifications

C++ exception syntax

Standard exception classes

Catching exceptions by type

Function try blocks

System errors

Nested exceptions

Structured Exception Handling

Compiler exception switches

Mixing C++ and SEH exception handling

Writing exception-safe classes

Summary

累计评论(0条) 0个书友正在讨论这本书 发表评论

发表评论

发表评论,分享你的想法吧!

买过这本书的人还买过

读了这本书的人还在读

回顶部