Thursday, 21 August 2025

Introducing C++: what it will cover

 As some of you may know, I'm writing a new book, this time for O'Reilly called "Introducing C++". 

You can see it on the O'Reilly platform and leave comments: you can get a short free trial if you haven't paid for access. 

Cover picture of two parrots

Someone on LinkedIn asked about the contents. I will have 15 chapters. I've written 14 so far, and 11 are on the platform at the moment.
The chapter titles are as follows:

Chapter 1: Hello, world!
Chapter 2: Variables and keyboard input
Chapter 3: Exceptions and expectations
Chapter 4: Using loops, a std::array, and a std::vector
Chapter 5: Using standard library algorithms
Chapter 6: Lambdas and the ranges library
Chapter 7: Random numbers
Chapter 8: Working with files
Chapter 9: Strings and formatting
Chapter 10: Classes: Member Variables and Member Functions 
Chapter 11: Classes: Special Member Functions and Move Semantics
Chapter 12: Memory Management with std::unique_ptr 
Chapter 13: Classes: Virtual functions and inheritance
Chapter 14: std::variant and std::visit
Chapter 15: Templates and unordered map

The precise titles might change, and I haven't written chapter 15 yet, but I have a plan. I was going to focus on templates, but introducing a key-value lookup container will be useful for beginners. 

I'm not going into modules, or showing how to use CMake or similar - I want to keep the book short enough to be able to actually read it through. I've got 301 pages so far, and intend to come in at 325 pages max (an index and preface might increase this slightly). 

I haven't covered everything, but start simply with printing some messages, then getting input. One of the first C++ books I read properly was "Accelerated C++", which was well loved when it was written. It's out of date now, but still a great book. It has a background theme of using student grades to show case many C++ features. I've picked a small trading stock games for my book. I think being able to write a program that does something, rather than trying to follow small snippets is a great way to learn.

If you can see the platform, do leave me feedback.






No comments:

Post a Comment