C++ Course: From C to C++


Switch from C to C++: Learn object-oriented programming, templates, and memory management for embedded systems with this hands-on training course.

Participants will learn

  • write a class in C++
  • use dynamic memory management in C++
  • use range-based for loops to write safe loops
  • avoid memory leaks by using smart pointers
  • understand and write generic code with templates

Duration

3 days

Prerequisites

Good knowledge of the C language.

Course Description

In this class, you will learn the new or different things in C++ compared to the language you already know and use, C.

The class assumes that you're coming from an embedded environment where you are making the transition from C to C++. Therefore we look only at constructs that are commonly used in constrained environments.

You will first learn about some notable differences between the two languages. Yes, some old habits will have to go.

Next, you will learn about the object-oriented part of C++, classes, and how they work.

This base is followed by various C++ features that make the language easy to use, such as range-based for loops.

There is also a section about dynamic memory management and what options you have in C++, still assuming there are several constraints.

Your next stop is writing and using generic code. You will learn about C++ templates, how to write them and where to apply them.

The final lesson is about a major part of C++, the Standard Template Library, short STL. I present a list of headers that are safe to use in constraint environments. Next, you will learn about some STL elements that will ease your life.

After this class, you have a good understanding of programming C++. Your existing knowledge of C and this class will help you to adapt to C++ quickly.

Course Outline

  • From C to C++
    • Scope of variables
    • Boolean values
    • References
    • Functions
    • Function overloading
    • Overloaded functions and NULL
    • nullptr
    • namespace
    • struct
    • Explicit data type conversion
    • C headers in C++
  • Classes and inheritance
    • class
    • The this pointer
    • explicit
    • Default member initialization
    • Constructor delegation
    • Use the destructor
    • Member functions and const
    • static member functions
    • Class operators
    • Operator overloading
    • Operators in action
    • Deliberately disable member functions
    • class or struct
    • Inheritance
    • Virtual functions
    • Abstract class
    • override
    • final
    • Why inheritance?
    • Inheritance and destructors
    • Constructor inheritance
    • Literal variants
  • Language features in C++
    • Uniform initialization
    • Placeholder data type: auto
    • Placeholder data type as return type
    • range-based for loops
    • class enum
    • Digit separator
    • using
  • Dynamic memory management
    • new
    • delete
    • Placement-new
    • The new and delete operator
    • std::unique_ptr
  • Template basics
    • What is generic programming
    • Function templates
    • Variadic templates
    • Class templates
    • Alias templates
    • Guidelines for efficient use of templates
    • Thinking in types
    • constexpr if
    • Curiously Recurring Template Pattern
  • Interesting parts of the Standard Template Library
    • STL rules of thumb
    • Safe headers for embedded environments
    • std::chrono
    • std::tuple
    • std::array
    • std::all_of
    • std::count_if
    • std::copy

Curious about how my C++ courses work?

Would you like to get a better idea of me and my teaching style in advance? Then I invite you to watch this excerpt from a recording of a one-hour online workshop.

Included in this course are

  • A color PDF handout, which includes all references and an acronyms list.
  • The source code for the exercises as well as sample solutions for all exercises as a ZIP-file.
  • Certificate of attendance.
  • A complimentary copy of one of my books.
Notebook C++: Tips and Tricks with Templates
Notebook C++: About move semantics
Programming with C++20

What you can expect from my training courses.

My motto is "Write unique code." I like to reduce the code to the necessary parts. Duplication can be done using templates or functions so that, in the end, each individual piece of code clearly contributes to the code base. Only the unique code reduces maintenance. It gives you more time to focus on your next customer needs.

In order to write unique code in practice, all training courses have a high practical component. Impulses and presentations complement practical exercises. In any case, my sessions are very interactive. I like to hear what the participants think to give the right tips. This creates a training experience in which each participant learns something new and achieves their learning success. The training components build on each other didactically and in terms of content. And I answer questions at any time.

The live demo parts are an essential part of my lessons. I use the following two tools there:

Request course now

Not the right course?

You have not found the right training course or would like a modification? I would be happy to create a training course for your needs. Simply contact me with your request: Contact now

Looking for a course in German? I offer all my classes in German as well.