int main() { Counter i; std::cout << "The value of i is " << i.GetItsVal() << std::endl; i.Increment(); std::cout << "The value of i is " << i.GetItsVal() << std::endl; ++i; std::cout << "The value of i is " << i.GetItsVal() << std::endl; return 0; }
int main() { Counter i; cout << "The value of i is " << i.GetItsVal() << endl; i.Increment(); cout << "The value of i is " << i.GetItsVal() << endl; ++i; cout << "The value of i is " << i.GetItsVal() << endl; Counter a = i++; cout << "The value of a: " << a.GetItsVal()<<endl; ++a; cout << " and a: " << a.GetItsVal() << endl; cout<<"address of i is: "<<&i<<endl; cout<<"address of a is: "<<&a<<endl; return 0; }
Counter::Counter(const Counter& thecounter): itsVal(thecounter.GetItsVal()) {cout<<"Copy Constructor\n";};