Turn from: http://blog.csdn.net/feixiaoxing/article/details/6785924
An arithmetic overload is an attribute of a class, but each person uses a different method. Good use, but if not the correct use, it will be endless.
(1) Introduction of simple arithmetic characters
So what is an arithmetic overload? We can give an example. In general, when we define two variables of type int, we can add, subtract, multiply, and divide the two types, and compare judgment, print, array operation, * operation, and so on. So what should we do if we want to define our own classes with such attributes? Of course, the arithmetic character overload is necessary. First, we do a definition of the basic class:
View plain class desk { public: int price; desk (int value):p rice (value) {} ~desk () {} desk& operator+= (desk&  D) { this->price += d.price; return *this; } }; below, you can use an example function to illustrate the method used:
View Plain 74: desk n (5); 0040126d push 5 0040126f lea ecx,[ebp-10h] 00401272 call @ILT +0 (desk::d Esk) (00401005) 00401277 mov dword ptr [ebp-4],0 75: desk m (; ) 0040127e push 0Ah 00401280 lea ecx,[ebp-14h] 00401283 call @ILT +0 (desk::d Esk) (00401005)