[cpp #include <iostream> class A { int val; int rptct; // Number of times the object is reported. public: A(int v) : val(v), rptct(0) { } ~A() { cout << val << " was reported " << rptct << " times."; } void report() const; }; void A::report() const { const_cast<A*>(this)->rptct++; cout << val << endl; } int main() { const A a(123); a.report(); a.report(); a.report(); return 0; }