Structures & OOP

Lessons in this group, roughly in build order:

  • structs — A struct groups named members into one object; in C++ it is a full class whose members default to public,…
  • classes-objects — A class is a user-defined type bundling data members with the functions that operate on them; an object is…
  • access-specifiers — public, protected, and private control which code may name a member, enforcing the boundary between a…
  • constructors-destructors — A constructor establishes a class’s invariants when an object comes into existence; a destructor releases…
  • copy-move-constructors — The copy constructor builds an object as a duplicate of another (T(const T&)); the move constructor steals…
  • operator-overloading — Operator overloading gives built-in syntax (+, ==, [], <<) custom meaning for your types, so user-defined…
  • this-pointer — this is the implicit pointer, passed to every non-static member function, that addresses the object the…
  • static-members — A static member belongs to the class itself, not to any object: one shared variable or a function with no…
  • friend-functions-classes — A friend declaration grants a specific external function or class access to a type’s private and protected…
  • inheritance — Inheritance derives a new class from an existing one, reusing and extending its members and establishing…
  • polymorphism-virtual-functions — A virtual function lets a call through a base pointer/reference dispatch to the derived override at…
  • abstract-classes-interfaces — A class with at least one pure virtual function (= 0) is abstract: it cannot be instantiated and exists…
  • encapsulation — Encapsulation bundles data with the operations that act on it and hides the representation behind a…
  • the-rule-of-0-3-5 — A guideline for the five special member functions: define all of them or none — and ideally none, by…