19.3 — 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 …

14.6 — Access functions

In previous lesson , we discussed the public and private access levels. As a reminder, classes typically make their data members private, and private members can not be directly accessed by the public. Consider the following Date class: #include <iostream> class Date { private: int m_year{ 2020 }; int m_month{ …