1. Trang chủ
  2. » Khoa Học Tự Nhiên

Beginning c++ programming richard grimes 1st edition

990 101 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Cấu trúc

  • 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

Nội dung

Title Page Beginning C++ Programming This is the start of your journey into the most powerful language available to the programming public Richard Grimes BIRMINGHAM - MUMBAI Copyright Beginning C++ Programming Copyright © 2017 Packt Publishing All rights reserved No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews Every effort has been made in the preparation of this book to ensure the accuracy of the information presented However, the information contained in this book is sold without warranty, either express or implied Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book Packt Publishing has endeavoured to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals However, Packt Publishing cannot guarantee the accuracy of this information First published: April 2017 Production reference: 1180417 Published by Packt Publishing Ltd Livery Place 35 Livery Street Birmingham B3 2PB, UK ISBN 978-1-78712-494-3 www.packtpub.com Credits Author Copy Editor Richard Grimes Safis Editing Reviewer Project Coordinator Angel Hernandez Vaidehi Sawant Commissioning Editor Proofreader Aaron Lazar Safis Editing Acquisition Editor Indexer Nitin Dasan Tejal Daruwale Soni Content Development Editor Graphics Zeeyan Pinheiro Abhinash Sahu Technical Editor Production Coordinator Pavan Ramchandani Shraddha Falebhai   printing out the outer exception, you call a function like this: void print_exception(exception& outer) { cout

Ngày đăng: 16/10/2021, 15:38