Description
Efnisyfirlit
- Introduction
- About This Book
- Icons Used in This Book
- Beyond the Book
- Where to Go from Here
- Part I: Getting Started with C++ Programming
- Chapter 1: Writing Your First C++ Program
- Grasping C++ Concepts
- Installing Code::Blocks
- Windows
- Ubuntu Linux
- Macintosh
- Creating Your First C++ Program
- Creating a project
- Entering the C++ code
- Cheating
- Building your program
- Executing Your Program
- Reviewing the Annotated Program
- Examining the framework for all C++ programs
- Clarifying source code with comments
- Basing programs on C++ statements
- Writing declarations
- Generating output
- Calculating Expressions
- Storing the results of an expression
- Examining the remainder of Conversion
- Chapter 2: Declaring Variables Constantly
- Declaring Variables
- Declaring Different Types of Variables
- Reviewing the limitations of integers in C++
- Solving the truncation problem
- Looking at the limits of floating point numbers
- Declaring Variable Types
- Types of constants
- Range of Numeric Types
- Special characters
- Wide Loads on Char Highway
- Are These Calculations Really Logical?
- Mixed Mode Expressions
- Automatic Declarations
- Chapter 3: Performing Mathematical Operations
- Performing Simple Binary Arithmetic
- Decomposing Expressions
- Determining the Order of Operations
- Performing Unary Operations
- Using Assignment Operators
- Chapter 4: Performing Logical Operations
- Why Mess with Logical Operations?
- Using the Simple Logical Operators
- Storing logical values
- Using logical int variables
- Be careful performing logical operations on floating-point variables
- Expressing Binary Numbers
- The decimal number system
- Other number systems
- The binary number system
- Performing Bitwise Logical Operations
- The single-bit operators
- Using the bitwise operators
- A simple test
- Chapter 5: Controlling Program Flow
- Controlling Program Flow with the Branch Commands
- Executing Loops in a Program
- Looping while a condition is true
- Using the autoincrement/autodecrement feature
- Using the for loop
- Avoiding the dreaded infinite loop
- For each his own
- Applying special loop controls
- Nesting Control Commands
- Switching to a Different Subject?
- Part II: Becoming a Functional C++Programmer
- Chapter 6: Creating Functions
- Writing and Using a Function
- Defining our first function
- Defining the sumSequence() function
- Calling the function sumSequence()
- Divide and conquer
- Understanding the Details of Functions
- Understanding simple functions
- Understanding functions with arguments
- Overloading Function Names
- Defining Function Prototypes
- Defaulting Arguments
- Passing by Value and Passing by Reference
- Variable Storage Types
- Chapter 7: Storing Sequences in Arrays
- Arraying the Arguments for Arrays
- Using an array
- Initializing an array
- Accessing too far into an array
- Arraying range-based for loops
- Defining and using arrays of arrays
- Using Arrays of Characters
- Creating an array of characters
- Creating a string of characters
- Manipulating Strings with Character
- Adding Some Library Functions
- Making Room for Wide Strings
- Chapter 8: Taking a First Look at C++ Pointers
- Variable Size
- What’s in an Address?
- Address Operators
- Using Pointer Variables
- Using different types of pointers
- Passing Pointers to Functions
- Passing by value
- Passing pointer values
- Passing by reference
- Constant const Irritation
- Making Use of a Block of Memory Called the Heap
- Limited scope
- Examining the scope problem
- Providing a solution using the heap
- Chapter 9: Taking a Second Look at C++ Pointers
- Defining Operations on Pointer Variables
- Reexamining arrays in light of pointer variables
- Applying operators to the address of an array
- Expanding pointer operations to a string
- Justifying pointer-based string manipulation
- Applying operators to pointer types other than char
- Contrasting a pointer with an array
- When Is a Pointer Not?
- Declaring and Using Arrays of Pointers
- Utilizing arrays of character strings
- Accessing the arguments to main()
- Chapter 10: The C++ Preprocessor
- What Is a Preprocessor?
- Including Files
- #Defining Things
- Okay, how about not #defining things?
- Enumerating other options
- Including Things #if I Say So
- Intrinsically Defined Objects
- Typedef
- Part III: Introduction to Classes
- Chapter 11: Examining Object-Oriented Programming
- Abstracting Microwave Ovens
- Preparing functional nachos
- Preparing object-oriented nachos
- Classifying Microwave Ovens
- Why Classify?
- Chapter 12: Adding Class to C++
- Introducing the Class
- The Format of a Class
- Accessing the Members of a Class
- Activating Our Objects
- Simulating real-world objects
- Why bother with member functions?
- Adding a Member Function
- Calling a Member Function
- Accessing other members from a member function
- Scope Resolution (And I Don’t Mean How Well Your Telescope Works)
- Defining a Member Function in the Class
- Keeping a Member Function after Class
- Overloading Member Functions
- Chapter 13: Point and Stare at Objects
- Declaring Arrays of Objects
- Declaring Pointers to Objects
- Dereferencing an object pointer
- Pointing toward arrow pointers
- Passing Objects to Functions
- Calling a function with an object value
- Calling a function with an object pointer
- Calling a function by using the reference operator
- Why Bother with Pointers or References?
- Returning to the Heap
- Allocating heaps of objects
- When memory is allocated for you
- Linking Up with Linked Lists
- Performing other operations on a linked list
- Hooking up with a LinkedListData program
- Ray of Hope: A List of Containers Linked to the C++ Library
- Chapter 14: Protecting Members: Do Not Disturb
- Protecting Members
- Why you need protected members
- Discovering how protected members work
- Making an Argument for Using Protected Members
- Protecting the internal state of the class
- Using a class with a limited interface
- Giving Non-member Functions Access to Protected Members
- Chapter 15: “Why Do You Build Me Up, Just toTear Me Down, Baby?”
- Creating Objects
- Using Constructors
- Constructing a single object
- Constructing multiple objects
- Constructing a duplex
- Dissecting a Destructor
- Why you need the destructor
- Working with destructors
- Chapter 16: Making Constructive Arguments
- Outfitting Constructors with Arguments
- Using a constructor
- Placing Too Many Demands on the Carpenter: Overloading the Constructor
- Defaulting Default Constructors
- Constructing Class Members
- Constructing a complex data member
- Constructing a constant data member
- Reconstructing the Order of Construction
- Local objects construct in order
- Static objects construct only once
- All global objects construct before main()
- Global objects construct in no particular order
- Members construct in the order in which they are declared
- Destructors destruct in the reverse order of the constructors
- Constructing Arrays
- Constructors as a Form of Conversion
- Chapter 17: The Copy/Move Constructor
- Copying an Object
- Why you need the copy constructor
- Using the copy constructor
- The Automatic Copy Constructor
- Creating Shallow Copies versus Deep Copies
- It’s a Long Way to Temporaries
- Avoiding temporaries, permanently
- The move constructor
- Chapter 18: Static Members: Can Fabric Softener Help?
- Defining a Static Member
- Why you need static members
- Using static members
- Referencing static data members
- Uses for static data members
- Declaring Static Member Functions
- What Is this About Anyway?
- Part IV: Inheritance
- Chapter 19: Inheriting a Class
- Do I Need My Inheritance?
- How Does a Class Inherit?
- Using a subclass
- Constructing a subclass
- Destructing a subclass
- Inheriting constructors
- Having a HAS_A Relationship
- Chapter 20: Examining Virtual Member Functions: Are They for Real?
- Why You Need Polymorphism
- How Polymorphism Works
- When Is a Virtual Function Not?
- Considering Virtual Considerations
- Chapter 21: Factoring Classes
- Factoring
- Implementing Abstract Classes
- Describing the abstract class concept
- Making an honest class out of an abstract class
- Passing abstract classes
- Part V: Security
- Chapter 22: A New Assignment Operator, Should You Decide to Accept It
- Comparing Operators with Functions
- Inserting a New Operator
- Creating Shallow Copies Is a Deep Problem
- Overloading the Assignment Operator
- Overloading the Subscript Operator
- The Move Constructor and Move Operator
- Chapter 23: Using Stream I/O
- How Stream I/O Works
- Default stream objects
- Stream Input/Output
- Open modes
- Hey, file, what state are you in?
- Can you show me an example?
- Other Methods of the Stream Classes
- Reading and writing streams directly
- Controlling format
- What’s up with endl?
- Positioning the pointer within a file
- Using the stringstream Subclasses
- Manipulating Manipulators
- Chapter 24: Handling Errors — Exceptions
- Justifying a New Error Mechanism?
- Examining the Exception Mechanism
- What Kinds of Things Can I Throw?
- Just Passing Through
- Chapter 25: Inheriting Multiple Inheritance
- Describing the Multiple Inheritance Mechanism
- Straightening Out Inheritance Ambiguities
- Adding Virtual Inheritance
- Constructing the Objects of Multiple Inheritance
- Voicing a Contrary Opinion
- Chapter 26: Tempting C++ Templates
- Generalizing a Function into a Template
- Class Templates
- Tips for Using Templates
- External Template Instantiations
- Implementing an Initializer List
- Chapter 27: Standardizing on the Standard Template Library
- The string Container
- Iterating through Lists
- Making your way through a list
- Operations on an entire list
- Can you show me an example?
- Chapter 28: Writing Hacker-Proof Code
- Understanding the Hacker’s Motives
- Understanding Code Injection
- Examining an example SQL injection
- Avoiding code injection
- Overflowing Buffers for Fun and Profit
- Can I see an example?
- How does a call stack up?
- Hacking BufferOverflow
- Avoiding buffer overflow — first attempt
- Avoiding buffer overflow — second attempt
- Another argument for the string class
- Why not always use string functions?
- Part VI: The Part of Tens
- Chapter 29: Ten Ways to Avoid Adding Bugs to Your Program
- Enable All Warnings and Error Messages
- Adopt a Clear and Consistent Coding Style
- Limit the Visibility
- Comment Your Code While You Write It
- Single-Step Every Path at Least Once
- Avoid Overloading Operators
- Manage the Heap Systematically
- Use Exceptions to Handle Errors
- Declare Destructors Virtual
- Avoid Multiple Inheritance
- Chapter 30: Ten Ways to Protect Your Programs from Hackers
- Don’t Make Assumptions about User Input
- Handle Failures Gracefully
- Maintain a Program Log
- Follow a Good Development Process
- Implement Good Version Control
- Authenticate Users Securely
- Manage Remote Sessions
- Obfuscate Your Code
- Sign Your Code With a Digital Certificate
- Use Secure Encryption Wherever Necessary
- About the Author
- Cheat Sheet
- More Dummies Products
Reviews
There are no reviews yet.