Course in Modern C++ for C Programmers

Fundamental course in Modern C++, based on the new standard C++ 11/14/17, aimed at C developers

C++ was created as an improver version of C, that is where its name come from. We show in this course that everything you can do in C you can also do in C++, however with much improved maintainability and increased code quality.

This basic course is aimed at experienced C programmers, whom as quickly as possible want to start programming i C++. We consistenty refer to C and illustrate similarities and point out differences.

Of course we use modern C++, Which means C++17, a modern design perspective and frequently use of the standard library.

We can't resist to quote Bjarne Stroupstrup, the creator of the language when he speaks about this:

Within C++ is a smaller, simpler, safer language struggling to get out.

Where he put the focus on that

...code that is statically type safe, has no resource leaks, and catches many more programming logic errors than is common in code today. And it will run fast.
This is what you will learn
  • Program in Modern C++
  • Effective usage of the standard library
  • Design user-defined data types
  • Understand and apply insights regarding memory management in C++
Course Contents

Background and Overview

A few words about the evolution of the language

  • Langauge evolution
  • The concept Modern C++
  • Syntax summary
  • Simple compilation
  • C++ reference

Similarities with C

We start with simpler parts of the language where C++ and C are the same language.

  • Data types
  • Expressions
  • Statements
  • Function declarations and function calls

Differences to C

In this chapter we discuss how C++ deviates from C

  • Namespaces
  • Function overloading
  • Function default parameters
  • Template functions
  • Type casts
  • Type aliases


In this chapter we discuss C++ references, both lvalue and rvalue dito

  • What is reference and do it differ from pointers
  • Call-by reference
  • Return by-reference
  • Rvalue references
  • What is move semantics and why is it important

Lambda Expressions

With the introduction of lambda expressions, C++ have definitely entered the stage of modern and hip languages.

  • Lambda syntax
  • Passing free variables by reference or value
  • Functions taking lambdas as parameters and/or returning lambdas

Text Strings and Regexes

The majority of bugs in C/C++ programs has their root in wrong usage of text strings. Just by consequently use std::string instead, the code quality increases significantly. In this chapter we discuss how to use the string class and utilize regex for searching and substitution.

  • Why using std::string instead of nativ strings
  • Overview of std::string and its functions/operators
  • What is SSO (Short String Optimization) and how it is used
  • Working with legacy strings
  • Character oriented functions
  • Multi-line string literals
  • What is a regex
  • The regex support in modern C++
  • Matching text data to patterns
  • Searching using patterns
  • Replacing text fragments using patterns
  • Using regex iterators
  • Typical use cases
  • Splitting and joining strings

I/O Streams and Files

In this chapter we discuss how to apply formatted I/O with the console, files, and buffers.

  • ostream / ofstream / ostringStream
  • istream / ifstream / istringstream
  • Bi-directional I/O with fstream
  • Manipulators
  • The input idiom
  • Line-oriented input
  • Word-oriented input
  • Character-oriented input

Helper Types

Discssion of helper classes and function you need to know about

  • Pair
  • Tuple
  • Date-times
  • Durations
  • Clocks
  • Date formatting
  • Random number generators

Container Types

Discussion of the STL container types

  • Sequence containers and typical methods
  • vector / dequeue / array
  • list / forward_list
  • Associative containers
  • Tree vs. hash implementations
  • Unique vs. multi-key versions
  • set / unordered_set
  • map / unordered_map
  • Container adapters

Iterators and Intervals

Discussion of the STL iterator concept

  • What is an iterator
  • What is a range and how is it used
  • Iterator categories
  • I/O iterators
  • End-point adapter functions

STL Algorithms

Discussion of STL algorithms

  • What is a std::* algorithm
  • The STL architecture
  • How to pass the business logic into algorithm functions
  • Understanding *_n and *_if suffixes of functions
  • Using functions with predicates
  • Using back_insereter iterators
  • Transforming and aggregating
  • Sorting
  • Populating data inot containers

Classes (User Defined Types)

How to define user-defined types, aka classes

  • What is a user-defined type
  • Specification vs. implementation
  • Member variables and functions
  • Object creation (instantitation)
  • Visibility
  • Constructors
  • Destructor
  • Inline member functions
  • Member overloading
  • The pointer 'this'

Class Member Forms

Discussion of all variants of class member forms

  • Class variables and functions
  • Member references
  • Read-only variables
  • Const marked functions
  • Inner classes
  • Friend declarations

Constructors and Destructors

All you need to know about constructors and destructors

  • Initialization
  • Default constructor
  • Destructor
  • Copy constructor
  • Assignment operator
  • Pitfalls
  • Standardized class form
  • Enforcing compiler-generated members
  • Deleting compiler-generated members
  • Type conversion constructor
  • Type conversion operator
  • What is move semantics
  • Move constructor
  • Move assinment operator

Heap Allocated Objects

How to create and maintain dynamically allocated memory blocks

  • What is dynamic memory anyway
  • Using the new and delete operators
  • Pitfalls
  • The placement variant of new


How to deal with exceptions

  • What is an exception
  • Throwing exceptions
  • Catching exceptions
  • The merrits of automatic destructions during throw
  • Exceptions in the standard library
  • Pitfalls


C++ is primarly a template meta-programming langauge. In this chapter we tell you more.

  • What is a template
  • Function templates
  • Class Templates
  • Member function templates
  • Template parameter forms
  • Type eqiuvalence
  • Template specialization
  • Pitfalls
  • Type traits
  • Using decltype()
  • Variadic templates

Operator Overloading

User-defined operator overloading is the key to DSL (Domain Specific Language).

  • What is operator overloading
  • Syntax
  • Overloadable operators
  • Rule set
  • Overloading of arithemtic operators
  • Overloading of relational operators
  • Overloading of I/O operators
  • Overloading of ++/-- operators
  • Overloading of the index operator
  • Overloading of the arrow operator
  • Overloading of the function-call operator

Inheritance and Virtual Functions

Here we discuss class hierachies, inheritance and virtual functions

  • Syntax
  • Protected visibility
  • There is no such thing as package visibility in C++
  • Invocation of super-class members
  • References and pointers of root class type
  • Performing down-casts using dynamic_cast
  • Constructor initialization order
  • Base class visibility
  • Virtual member functions and why they are important
  • What is the key difference between virtual methods and non-virtual methods in C++
  • How do I make a class and/or method abstract in C++
  • Use of override and final specifiers
  • Multiple inheritance and why you need to be careful
  • Implementing interfaces in C++

The Pre-Processor

How to use the C pre-processorm; when to use and when not to

  • Include files
  • CPP constants
  • Pre-defined constants
  • Conditional compilation
  • Include guards
  • CPP macro functions
  • Stringification and name catenation
  • Assertions

Building C++ Applications

Brief discussion about how to compile and build C++ applications

  • Compilation steps
  • What is an abstract syntax tree (AST)
  • The assembler
  • Inline assembly code
  • The linker
  • Name mangling of C++ names
  • Inspecting the linker symbol table
  • The loader
  • Tracing executions
  • Compiler flags for warnings
  • Compiler flags for optimizations
  • Compiler flags for debugging
  • Creating a static archive file
  • Creating a dynamic linked library

Build Tools and Open-Source Libraries

Overview of some build tools and open-source libraries

  • Make
  • GNU Autotools
  • Premake
  • CMake
  • Gradle
  • Doxygen
  • Google Test
  • log4cxx
  • Boost

Standards and Guidelines

The C++ standardization process

  • Tracking the standard
  • Tracking compilers and what they support
  • Online compilers
  • The big C++ conference (cppcon)
  • The C++ Core Guidelines
  • GSL - The Guidelines Support Library
NameModern C++ for C Programmers
Duration 4 Days
AudienceExperienced C developers
Prerequisites Working knowledge and experience of C programming
  • GCC/G++ compiler, version 8 or later
  • Jetbrains CLion IDE
  • Ubuntu Linux @ VirtualBox or WLS @ Windows-10
Course Dates
DatePlace Price
2020-02-10Stockholm 24 000 kr
2020-03-02Stockholm 24 000 kr
2020-03-23Stockholm 24 000 kr
2020-04-06Stockholm 24 000 kr
2020-05-04Stockholm 24 000 kr
2020-06-01Stockholm 24 000 kr

Same-Company Discout

We offer a 20% discount for additional participants from the same company and at the same course date. Read more here.

Teaching Language

Our printed course material is always authored in English. The oral presentation in our classrooms is generally in Swedish, unless all participants agree to that we perform the course in English.

On-Site Course

If you order an On-Site course, we will come to you and hold the course in your office. The price is determined by our price model and is based on the number of course days, number of participants and any travel and lodging.

Read more about out price modell and term of sales here.

Related Courses
CourseDays Level
C++ Supplementary3IntermediateShow
Unit Testing in C++ with Google Test1IntermediateShow
Threads Programming using Modern C++3 Advanced Show
Linux Systems Programming using Modern C++3AdvancedShow
C++ 11/14/17 for C++ Programmers3 IntermediateShow