This is the first session in a series of 10 labs covering various aspects of programming in C++; ranging from the most basic examples to more complicated topics. Most of the things covered in the theoretical course notes will be applied in practice during these sessions. For starters, you'll see an introduction to the more practical aspects of the labs: setting up the programming environment, version control, etc.
You will learn about the various types of variables such as built-in primitive types, structures, and classes. Also covered are pointers and references to variables and the semantics of passing and retrieving data from functions as well as conversions between various types.
This session covers construction and destruction of class objects and other related topics. You'll also see how operator overloading works and how it can be used for convenience. We end this session with an explanation on continuous integration using CircleCI.
This week first covers the important concepts of smart pointers, move semantics and rvalue references.
Today's lab session covers class inheritance and the use of abstract classes. Of special importance are the details concerning creation, destruction and copying of objects within class hierarchies. Along the way you will learn a small & handy C++11 feature. The main exercise builds upon the function-plotter exercise you did last week.
We will first start off with a small test to check your inheritance skills after session 4. Afterwards, "safe programming" is the main topic of today's lab session: error handling through the use of exceptions. We'll also cover a small addition to operator overloading: user-defined typecast operators. Also covered: a utility library for parsing command-line arguments and some interesting debugging tools to help improve your (project) C++ code.
We start this session by introducing the auto keyword, before getting into some more complex C++ features: lambda functions, function pointers, functors, polymorphic function wrappers, and pointers to member functions. Finally, we end the session with a gentle introduction to C++ multithreading.
This lab session is entirely dedicated to the subject of C++ function templates. It's no exaggeration to say that templates are a very advanced topic. However, the introduction of templates to C++ in 1989 was a huge step towards the development of generic containers and algorithms in C++. A couple of examples and exercises should get you started.
While the previous lab was entirely dedicated to C++ function templates, in this session, we'll focus on class templates. While function templates share many similarities, they also have important differences that need to be considered. Ultimately, we'll also scratch the surface of template metaprogramming.