DMarlon Studio

Advanced C++ course

For those who know the basics: the techniques used in real projects. In DMarlon Studio, C++ powers native desktop apps with FLTK and the console: design the window and the studio generates the C++.

Start
  1. 1Classes and const methodsWrite your own C++ classes: members, a constructor and const methods, with a bank account that takes deposits and withdrawals.Lesson 1
  2. 2Encapsulation and initializer listsProtect a C++ class's data with private members and getters, and build its members with an initializer list: a thermostat that stays in range.Lesson 2
  3. 3Inheritance and virtual functionsInherit from a C++ class and replace its methods with virtual and override, and see object slicing in action, with a staff payroll.Lesson 3
  4. 4Abstract classes and polymorphismDefine an interface with pure virtual functions in C++ and handle different objects through base pointers: payment methods and their fees.Lesson 4
  5. 5Operator overloadingGive your C++ classes their own operators (+, *, +=, ==, < and <<) with a Money type that stores cents, so sums never lose a penny.Lesson 5
  6. 6RAII and destructorsRelease resources without forgetting with RAII and destructors in C++: a connection that closes itself and a transaction that rolls back on errors.Lesson 6
  7. 7unique_ptr and shared_ptrUse C++ smart pointers, unique_ptr and shared_ptr, so memory frees itself: songs with a single owner or shared by several playlists.Lesson 7
  8. 8Copy and moveTell copying from moving in C++: the rule of five, std::move and noexcept, with an image class that manages its own memory.Lesson 8
  9. 9Function templatesWrite one C++ function for many types with templates: the largest of a list of numbers, words or versions, plus a generic clamp.Lesson 9
  10. 10Class templatesBuild a generic ring buffer with a C++ class template, with the type and the size as parameters: sensor readings and recently opened files.Lesson 10
  11. 11Lambdas and capturesWrite functions on the spot with C++ lambdas: sort tasks, capture variables by value or by reference, and use mutable and auto parameters.Lesson 11
  12. 12STL algorithmsProcess data in C++ with transform, accumulate, count_if, find_if and remove_if with erase: a shop's sales without writing loops.Lesson 12
  13. 13IteratorsWalk through C++ containers with iterators: begin, end, rbegin, next, distance and erase on a std::list, with a route and a playlist.Lesson 13
  14. 14set, unordered_map and dequeChoose the right C++ container: std::set for unique sorted values, std::unordered_map to count page visits and std::deque for a print queue.Lesson 14
  15. 15optional, variant and visitModel values that may be missing with std::optional, and values of several types with std::variant and std::visit, in C++17: ports and cells.Lesson 15
  16. 16Namespaces and enum classOrganise C++ code with namespaces, aliases and using, and use enum class for safe named states: the steps of an online order.Lesson 16
  17. 17Custom exception hierarchiesCreate your own C++ exceptions by deriving from std::runtime_error, with extra data, and catch them from the most specific to the most general.Lesson 17
  18. 18std::function and callbacksBuild an event system in C++ with std::function: register lambdas, functions and methods as callbacks and call them when each event fires.Lesson 18
  19. 19constexpr and static_assertCompute at compile time with constexpr, check conditions with static_assert and pick code with if constexpr: sizes, ratios and tables in C++.Lesson 19
  20. 20Project: shape editorFinal project of the advanced C++ course: a shape editor with classes, polymorphism, unique_ptr and STL algorithms, ready for F9 in DMarlon Studio.Lesson 20