// File: ahack1.cpp // // An example of a hack. // #include #include using namespace std ; class ABC { public: ABC() { It = 17 ; } // A const member function cannot change // the value of a data member, right? // void ChangeIt() const ; void PrintIt() const { cout << It << endl ; } private: int It ; } ; int main() { ABC X ; cout << "Before: " ; X.PrintIt() ; void *ptr = (void *) &X ; * (int *) ptr = 77 ; cout << "After: " ; X.PrintIt() ; } void ABC::ChangeIt () const { return ; }