C++ For Dummies
Kaup valmöguleikar
An accessible walkthrough of one of the world's most popular programming languages: C++ C++ For Dummies is your from-scratch guide that explains the essentials of what you need to know to understand the language and build your very first program in C++. Bradley Jones, experienced programmer and coding educator, packs this edition with examples and clear demonstrations that explain the “why” and the “how” of programming in C++, as well as the programming concepts that will form the foundation of your code, including classes, loops, classes, objects, inheritance, and more.
C++ For Dummies provides easy-to-understand tutorials for the use of C++26 and explains the modern approach to printing and displaying information with the std::print method. It also discusses: Explanations of features that make C++26 better including modules, smart pointers, concepts, and ranges Walkthroughs of updated libraries for the filesystem, ranges, formatting, time, printing, and more Testing and debugging techniques Great for programmers, developers, students, or anyone interested in learning to code in C++ who are looking for a straightforward, hands-on approach to the language, C++ For Dummies is an accessible introduction to C++26 that offers readers a reliable head-start to a fun and rewarding skillset.
Nánar um bókina
- Wiley Professional Development (P&T)
- 9781394380466
- 9781394380442
- ePub
- 8
- Bradley L. Jones
- English
- 2026-03-30
- 100
- 10
- 2
Kaflar
- Cover
- Table of Contents
- Title Page
- Copyright
- Introduction
- About This Book
- Conventions Used in this Book
- Be Aware: This Is a Modern C++ Book
- Icons Used in This Book
- Beyond the Book
- Where to Go from Here
- Part 1: Getting Started with C++ Programming
- Chapter 1: Writing Your First C++ Program
- Grasping C++ Concepts
- Installing Code::Blocks
- Creating Your First C++ Program
- Executing Your Program
- Reviewing the Annotated Program
- Calculating Expressions
- And Now, a Few Comments on C++26
- Chapter 2: Storing Stuff in Variables
- Declaring Variables
- Declaring Different Types of Variables
- Declaring Variable Types
- Carrying Wide Loads on the char Highway
- Automatic Declarations
- Chapter 3: Doing the Math
- Performing Simple Binary Arithmetic
- Decomposing Expressions
- Determining the Order of Operations
- Performing Unary Operations
- Using Assignment Operators
- Chapter 4: Show Me the Good Stuff!
- The Old versus the New
- Printing the Old Way
- Printing the Modern Way
- The Pros and Cons of the Old Ways Versus the New
- Make It Stop!
- Chapter 5: Performing Logical Operations
- Why Mess with Logical Operations?
- Using the Simple Comparison Operators
- Adding Logic with the Logical Operators
- Streamlining with the Three-Way Comparison Operator
- Peeking at the Bitwise Logical Operations
- Chapter 6: Controlling the Flow
- Controlling Program Flow with the Branch Commands
- Executing Loops in a Program
- Nesting Control Commands
- Switching to a Different Subject?
- Part 2: Becoming a Functional C++ Programmer
- Chapter 7: Creating Functions
- Writing and Using a Function
- Exploring Functions
- Understanding Functions with Arguments
- Overloading Function Names
- Defining Function Prototypes
- Defaulting Arguments
- Passing by Value and Passing by Reference
- Understanding a Variable’s Visibility
- Benefiting from Functions
- Chapter 8: Grouping Similar Things Together Using Arrays
- Making the Case for Arrays
- Using an Array
- Using Arrays of Characters
- Manipulating Strings with Character
- Defining and Using Arrays of Arrays
- Using the Array Library Functions
- And Now the Bad News, Which Is Actually Good News
- Buffer Overflow: Overfilling Your Arrays
- Making Room for Wide Strings
- Chapter 9: Taking a First Look at C++ Pointers
- What’s in an Address?
- Addressing Address Operators
- Using Pointer Variables
- Passing Pointers to Functions
- Constant const Irritation
- Returning a Pointer from a Function
- Using Pointers and Allocating Memory for Variables
- Making Life Safe with Smart Pointers
- Using New Even Though It’s Now Old
- Chapter 10: Taking a Second Look at C++ Pointers
- Performing Operations on Pointer Variables
- Declaring and Using Arrays of Pointers
- Chapter 11: Using the C++ Preprocessor
- What Is a Preprocessor?
- #Defining Things
- Including Things #if I Say So
- Intrinsically Defined Objects
- Using Using and Typedef
- #Including Files
- Organizing with Modules
- One More Concept to Cover
- Part 3: Giving Your Program a Bit of Class
- Chapter 12: Examining Object-Oriented Programming
- Abstracting Microwave Ovens
- Classifying Microwave Ovens
- Why Classify?
- A Few Other Thoughts on OOP
- Chapter 13: Adding Class to C++
- Formatting a Class
- Accessing the Members of a Class
- Activating Our Objects
- 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
- Holding a Class in Public: Using Structs
- Nesting Structs and Classes
- Chapter 14: Separating Letters from Words: Character Arrays versus Strings
- Distinguishing Between a String and an Array of Characters
- The String Container
- Tapping into Your Library of String Functions
- Gaining a New View of Strings
- Taking a Deeper Dive into Formatting
- Changing Numbers to Strings
- Chapter 15: Pointing and Staring at Objects
- Declaring Arrays of Objects
- Declaring Pointers to Objects
- Passing Objects to Functions
- Why Bother with Pointers or References?
- Returning to the Heap
- Linking Up with Linked Lists
- Ray of Hope: A List of Containers Linked to the C++ Library
- Chapter 16: Protecting Members: Do Not Disturb
- Making Members Private
- Making an Argument for Using Private Members
- Getting Friendly with Your Private Members
- Chapter 17: “Why Do You Build Me Up, Just to Tear Me Down, Baby?”
- Creating Objects
- Using Constructors
- Dissecting a Destructor
- Smart Pointers, Deleting, and Destruction — Oh, My!
- Chapter 18: Making Constructive Arguments
- Outfitting Constructors with Arguments
- Placing Too Many Demands on the Carpenter: Overloading the Constructor
- Defaulting default Constructors
- Constructing Class Members
- Reconstructing the Order of Construction
- Constructing Arrays
- Constructors as a Form of Conversion
- Ignore That Value, Please
- Chapter 19: Making Copies with the Copy/Move Constructor
- Copying an Object
- The Automatic Copy Constructor
- Creating Shallow Copies versus Deep Copies
- It’s a Long Way to Temporaries
- The Move Constructor
- Just Because It Can Doesn’t Mean It Will
- Chapter 20: Adding Static Members: Can Fabric Softener Help?
- Creating a Function that Remembers
- Defining a Static Member
- Declaring Static Member Functions
- Static at a Global Level
- What Is This About Anyway?
- Part 4: A First Look at Inheritance
- Chapter 21: Passing the DNA: Sharing Code with Inheritance
- Do I Need My Inheritance?
- How Does a Class Inherit?
- Having a HAS_A Relationship
- Chapter 22: Creating Virtual Member Functions: Are They for Real?
- Why You Need Polymorphism
- How Polymorphism Works
- When Is a Virtual Function Not?
- Considering Virtual Considerations
- Virtual Destructors
- Let’s Go on a Tangent and Reflect on a New Topic
- Chapter 23: Factoring Classes
- Factoring
- Implementing Abstract Classes
- Packing for Traveling (and Lunch)
- Part 5: Object-Oriented Programming in Overdrive
- Chapter 24: Adopting 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
- No Copying Allowed!
- Overloading the Subscript Operator
- The Move Constructor and Move Operator
- Chapter 25: Playing with the Computer’s File System
- Working with Files Using Filesystem
- Creating and Working with Paths
- Iterating over Folders
- Does That File Exist?
- Peeking at a File’s Metadata
- The File System and Files
- Chapter 26: Twice the Fun: Tapping into Multiple Inheritance
- Describing the Multiple Inheritance Mechanism
- Straightening Out Inheritance Ambiguities
- Adding Virtual Inheritance
- Constructing the Objects of Multiple Inheritance
- Interfacing with C++
- Is It Better to Have or to Be? That Is the Question
- Reiterating a Contrary Opinion
- Chapter 27: Getting Ahead of Problems: Exception Handling, Contracts, and More
- Making an Exception to What I Just Said
- Justifying a New Error Mechanism?
- Examining the Exception Mechanism
- What Kinds of Things Can You Throw?
- Just Passing Through
- Scratching the Surface of Classy Exceptions
- Identifying What Is “Optional”
- Were You Expected?
- Using an Expected Value
- Preventing Problems before They Can Happen: Contracts
- Part 6: The Part of Tens
- Chapter 28: 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
- Out with the New and in with the Newer
- Avoid Multiple Inheritance
- Chapter 29: Ten Ways to Make Your Programs Easier to Update and Understand
- Pick Names Wisely
- Use Comments
- Write Modular Code
- Steer Clear of Reinventing the Wheel
- Style Your Code
- Don’t Leave Problems for Others
- Test, Test, and Then Test Again
- Use Modern Features
- Avoid Hard-Coded Values
- Use Version Control
- Index
- About the Author
- Dedication
- Author’s Acknowledgments
- Connect with Dummies
- End User License Agreement