This course presents the C++ programming language for programmers who already have some experience programming in another object-oriented language such as C#, Java, or a similar language. The course focuses on the differences between C++ and other languages, specifically on C++'s lack of garbage collection and the requirement for manual memory management. The course covers the basics of C++ data types, its core data structures, and also presents some of the more popular aspects of the C++ Standard Library.
Compilation and Linking Welcome. In this module we're going to talk about the Compilation and Linking processes that actually allow you to turn your C or C++ code into something that executes, or a library that somebody else can consume. So what are we going to cover in this module? Well, first of all, before we do anything, I want to actually open up Visual Studio and I want to write the most trivial C++ application, just so that you can see how it goes, how to write something, how the interface of Visual Studio works. Obviously you might be using a different IDE, but since we are using Visual Studio, I'm going to be doing all the explanations in that IDE. And then we jump again to the core of the matter, so we're going to talk about the preprocessing, that's the stage that happens before the actual compilation. Then we'll talk about the declarations and definitions that make up C++ projects. So the IDE here is somewhat different than what you're used to if you're programming in, well, just about any programming language out there. C++ is a little less convenient in terms of the way that you define the objects and their interfaces, but it does allow a certain flexibility and certain advantages as well. And then we'll talk about compilation itself, the process of compilation and the fact that I can be parallelized, for example. Then we'll talk about linking, which is what happens when you have compiled several of your translation units and you want to put them together, together with maybe some of the external libraries that you're using. And finally we'll talk about symbol export and take a look at an example of interoperability. That's when you have your C++ code that you've compiled into a library, for example, and you want to consume that library from a different programming language, so for example, from C#, so we'll take a look at the way that works.
Basic Syntax Welcome. This module covers the basics of the C++ language from the perspective of the data types that it supports and also covers the concepts of pointers and references which are key to understanding C++. So what exactly are we going to see in this module? First of all, we're going to discuss the integral types, then we're going to take a look at floating-point types, then we'll discuss the logical types, then we'll talk about the pointers and references, that's the key ideas of C++, then we're going to look at working with arrays, and then we'll discuss character types, as well as strings. Notice that since C++ is a language which has backwards compatibility with C, we're going to see some of the C-style syntax, as well as the modern syntax, in this module. My advice, as always, is to use the modern syntax if you can, but in certain cases there will be no avoiding using the C-style syntax.
Functions and Variables Welcome to this module on functions and variables. So in this module we'll finally get to write some code. Unlike the previous modules, this one is entirely hands on, and in this module we're going to be looking at functions, as well as variables of different types, both the types that we mentioned in the previous modules, as well as some entirely new data types and data structures. So what are we going to look at? Well, first of all we'll talk about namespaces and declarations on the Global Scope, and then we'll talk about the critical distinction between variables allocated on the Stack and the Heap and then we'll look at functions, as well as Lambda Functions, and then we'll look at some of the data structures that have been inherited from the C language, specifically enumerations, unions, and structures.
Control Flow Welcome. This is a rather short module because all we're going to do in this module is discuss some of the control flow differences between C++ and other languages, so there isn't much in here. What I'm going to cover is basically the for loop and this idea of iteration over collections. Then I'm going to talk about the switch statement; it has a peculiarity that isn't present in the other programming languages, and finally I'm going to once again come back to this idea of automatic conversions to Booleans and how they can actually be useful.
Object-Oriented Programming Welcome. In this module we're going to talk about object oriented program and this is probably one of the most important modules in the course because essentially the differences in the way that encapsulation, inheritance, polymorphism, the way that these things work in C++ compared to other languages is fairly significant and might present something of a challenge to developers of other programming languages. One thing I have to say right now as sort of a disclaimer, if you will, is that there is no way to cover every single aspect of OOP in C++ in a single module, so I'm going to cover as much as possible. The kind of things that we're going to look at are first of all, we'll talk about classes and we'll talk about the way that they are populated with member fields and member functions. Then we'll talk about constants and static members, how those are declined in the class. Then we'll talk about constructors and destructors. Then we'll talk about object copying, so things like the copy constructor and copy assignment statements. Then we'll talk about inheritance and then we'll talk about the access restrictions, the way that you can control what's visible in a class and what's not, and finally we'll talk about virtual members of a class.
Memory Management Welcome to the module. Now as we saw time and time again, heap allocated memory actually requires you to explicitly de-allocate it and it will not be cleaned up automatically if you allocate something on the heap. So in this module we're going to take a look at the ways in which this can be automated and simplified somewhat using various C++ constructs. So we're going to start by looking at role pointers and how to manage them in somewhat simple situations. We'll also take a look at the slightly bizarre case where an object can actually delete itself, but unfortunately, as we've seen from the previous modules, things sometimes get very difficult and one of those problems is the extra allocations that happen when you copy objects around, so we're going to look at move constructors and Rvalue references which prevent the number of allocations of memory. Afterwards we're finally going to solve this problem of returning a heap allocated variable from a function. Remember, before I warned that returning a stack allocated variable is unsafe because it might be invalidated by the time you return the pointer and of course returning a heap allocated variable is problematic as well because there is no way of telling the recipient that they need to explicitly de-allocate it, so we'll take a look at unique pointers and the way they actually help us out in this regard. And then we'll talk about sharing objects, so what happens if you have a heap allocated object that you're not just managing within some other object, but you want to share around. How can we actually keep track of how many instances are actually using this and this is what the shared pointer is for.
Templates Welcome. In this module we're going to talk about templates which are equivalent to generics in other languages. They enable generic programming which basically means that you can have functions and times which operate on different sorts of types, depending on the type parameter that's passed in, but it's not only about type parameters. So what we're going to discuss in this module is first of all, the idea of consuming templates, so before we before we write any template classes of our own we're going to actually make use of existing ones. Then we're going to talk about template classes and also template functions. Then we're going to talk about template specialization which is a way of providing specific implementation of a template class or a template function for a particular type or a particular value and then we're going to talk about variadic templates and we'll also talk about template metaprogramming.
Standard Template Library Welcome. In this module we're going to look at some aspects of the standard template library. Now this library is one of the core pieces of the C++ language itself and so it's rather large and this means that in this module we'll only be able to cover small slivers of the library. So what I want to show in this module is first of all, the containers, the standard containers that C++ supports. These are effectively the collection classes if you are used to the C+ and Java terminology, so things like vectors and associative arrays, that sort of thing. Then we're going to take a look at some of the algorithms that are used for things like sorting and searching. Then we're going to look at streams. We've already seen the standard output stream that we used to write things to the console, but we're also going to look at some of the other streams as well and we'll also take a look at numerics which are also a popular area of application of C++.