Introducing C++
  • Introducing C++
Moving from C to C++
  • C and C++ - similar in some ways but actually very different
  • C vs C++: Comments are different - and oh C++ has namespaces!
  • Namespaces? Then we need a scope resolution operator
  • Not just function overloading, C++ allows operator overloading as well!
  • Default Values
  • References, Const and Bool
Objects and Classes
  • Classes mean different things to different people!
  • Classes - A logical grouping of data and functions
  • Example 1 and 2: Define a really simple C++ class and instantiate it
  • Example 3: Invoke the member functions of an object
  • Example 4 and 5: Setup and clean up using constructors and destructors
  • Example 6: Access Modifiers
Multi-file Programs
  • Example 7: Separating code into .cpp and .h files
  • Example 7: Setting up dependencies with multiple files
Dynamic Memory Allocation: new and delete
  • Dynamic Memory Allocation
  • C++ memory allocation explained
  • Stop using malloc and free
  • Do not mix new/delete for single variables with array equivalents new[]/delete[]
  • Example 8 and 9: Stop using malloc and free, use new and delete instead!
  • Example 10 and 11: Use new[] and delete [] for arrays - never mix new and new[]
  • Example 12: The Placement new operator and the "this" pointer
The C++ string Class
  • The C++ string class
  • Example 14: Strings
  • Example 15: Inputing multiline strings
  • Example 16: More common string operations
  • Example 17: Comparing strings
  • Example 18: Converting C++ to C strings (and vice versa)
References
  • The basic idea of references
  • Example 19, 20 and 21: A simple reference, a const reference, and C++ swap
  • Example 22, 23, 24, 25: Reference initialization, reassignment, aliasing, null
  • Example 26, 27, 28, 29: References to pointers, references as return types
The const Keyword
  • Example 30 and 31: The C++ const keyword
  • Example 32: const char* or char* const?
  • Example 33, 34, 35, 36: Const methods, mutable, overloading on const, const_cast
  • Passing function parameters const references
  • Example 37: Passing function parameters const references
The static Keyword
  • The basic idea of static in C++
  • Example 38: Static member variables
  • Example 39 and 40: Static member functions
  • Example 41: const static member variables
The friend Keyword
  • The basic idea of friends in C++
  • Example 42: Friend functions
  • Example 43: Friend classes
Operator Overloading
  • Understanding operator overloading - internal and external operators
  • Choosing between internal and external implementations
  • Example 44: Overloading the += operator
  • Example 45: Overloading the + operator
  • Example 46: Overloading the ++ (and --) operators
  • Example 47: Overloading the assignment operator
  • Operator Overloading - Streams Flashback
  • Example 48: Overloading the << and >> operators
Inheritance
  • Understanding inheritance - Flashback to objects and classes
  • Example 49 Understanding Inheritance
  • Inheritance Explained - I
  • Inheritance Explained - II
  • Example 49: Access levels and inheritance types
  • Example 49: Bringing all inheritance concepts together in code
  • Examples 50, 51, 52: Types of inheritance
  • Example 53: virtual functions
  • Example 53 (continued)
  • Example 54: pure virtual functions and abstract classes
  • Example 55: Multiple Inheritance, and a Diamond Hierarchy
  • Example 56: Virtual inheritance in a Diamond Hierarchy
  • Example 57: Object Slicing
  • Example 58: No virtual function calls in constructors or destructors!
  • Example 59: Virtual destructors rock!
  • Example 60: Why virtual functions should never have default parameters
  • Example 61: The strange phenomenon of name hiding
  • Example 62: Never redefine non-virtual base class methods
Templates
  • Templates as a form of generic programming
  • Example 63: A simple template function
  • Example 64: Overriding a default template instantiation
  • Example 65: A templated smart pointer class
  • Example 66: Template Specialisation (partial or total)
STL - The Standard Template Library
  • Introducing the Standard Template Library
  • Example 67: The STL vector
  • Example 68: Iterators
  • Example 69: map, an associative container
  • Example 70: STL algorithms
C++ Casts
  • C++ casts are way cooler than C casts
  • Example 71: const_cast
  • Example 72: dynamic_cast, and RTTI
  • Example 73: static_cast, and the explicit keyword
Exceptions