13.9 — Destructors

A destructor is another special kind of class member function that is executed when an object of that class is destroyed. Whereas constructors are designed to initialize a class, destructors are designed to help clean up. When an object goes out of scope normally, or a dynamically allocated object is …

13.5 — Constructors

When all members of a class (or struct) are public, we can use to initialize the class (or struct) directly using list-initialization: class Foo { public: int m_x {}; int m_y {}; }; int main() { Foo foo { 6, 7 }; // list-initialization return 0; } However, as soon …