I'm working thru SAMS C++ in 21days and am confused by the operator overloading. Here's some code:

#include <iostream>
#include <stdlib.h>

class Counter
{
public:

Counter(int val);
~Counter(){}
int GetItsVal()const{return itsVal;}
void SetItsVal(int x){itsVal=x;}
void Increment(){++itsVal;}
Counter operator++();
private:
int itsVal;
};



Counter::Counter(int val):itsVal(val){}

Counter Counter:perator++()//WHY IS THIS COUNTER COUNTER? WHY 2 COUNTERS?
{
++itsVal;
return Counter(itsVal);
}

int main()
{
Counter i(0);
cout<<"i: "<<i.GetItsVal()<<endl;
i.Increment();
cout<<"i: "<<i.GetItsVal()<<endl;
++i;
cout<<"i: "<<i.GetItsVal()<<endl;
Counter a=++i;
cout<<"a: "<<a.GetItsVal()
<<" i: "<<i.GetItsVal()<<endl;

system("PAUSE");
return 0;
}

My question in comments above. To elaborate: Is this only done with the operator overloading? Is it because the function returns type Counter?

Thanks for any help on this...

BTW. The smiley is not original to the code, but is interpreted by the forums its the second colon and a lower case 'o'