ProgrammingIntermediateC++

C++ Programming Fundamentals

Move from C to modern C++: references and const, RAII, polymorphism without surprises, templates, and what move semantics actually do.

C++ is often taught as "C with classes", which is accurate and useless. The gap between C-with-classes and the language you will actually write is about *ownership*, and every serious topic in this course is a consequence of that one idea. It starts with references and `const`, because a function that takes `const std::string&` and one that take `std::string` by value behave identically and cost wildly different amounts. Then classes and RAII: a resource is acquired in a constructor and released in a destructor, so cleanup happens on every path out of a function, including the ones nobody wrote. Then polymorphism, where the trap is object slicing and the fix is one keyword. The last two modules are what separate modern C++ from C-with-classes: templates and the standard library, and move semantics with smart pointers. Copy elision, rvalue references and `std::unique_ptr` are not advanced topics — they are the reason a `std::vector` of large objects is fast, and the reason modern C++ no longer asks you to write `delete`.

4.6 (120) 760 students 105 min 11 lessons 200 XP on completion

What you will be able to do

  • Decide correctly between pass-by-value, pass-by-reference and pass-by-const-reference, and say what each costs
  • Explain what RAII guarantees and why it removes an entire category of leak and double-free bug
  • Avoid object slicing, and know when a base class needs a virtual destructor
  • Write a class template and use the standard library algorithms without hand-rolling loops
  • Explain copy elision, rvalue references and std::move, and when a move is not actually free
  • Choose between std::unique_ptr, std::shared_ptr and std::weak_ptr, and never write raw new/delete

Assessments

Module 4: Inheritance and Polymorphism

1 lessons
Dashboard