[over.inc] # 12 Overloading [[over]](./#over) ## 12.4 Overloaded operators [[over.oper]](over.oper#over.inc) ### 12.4.7 Increment and decrement [over.inc] [1](#1) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L3708) An [*increment operator function*](#def:operator_function,increment "12.4.7 Increment and decrement [over.inc]") is a function named operator++[.](#1.sentence-1) If this function is a non-static member function with no non-object parameters, or a non-member function with one parameter, it defines the prefix increment operator++ for objects of that type[.](#1.sentence-2) If the function is a non-static member function with one non-object parameter (which shall be of typeint) or a non-member function with two parameters (the second of which shall be of typeint), it defines the postfix increment operator++ for objects of that type[.](#1.sentence-3) When the postfix increment is called as a result of using the++ operator, theint argument will have value zero[.](#1.sentence-4)[107](#footnote-107 "Calling operator++ explicitly, as in expressions like a.operator++(2), has no special properties: The argument to operator++ is 2.") [*Example [1](#example-1)*: struct X { X& operator++(); // prefix ++a X operator++(int); // postfix a++}; struct Y { }; Y& operator++(Y&); // prefix ++b Y operator++(Y&, int); // postfix b++void f(X a, Y b) {++a; // a.operator++(); a++; // a.operator++(0);++b; // operator++(b); b++; // operator++(b, 0); a.operator++(); // explicit call: like ++a; a.operator++(0); // explicit call: like a++;operator++(b); // explicit call: like ++b;operator++(b, 0); // explicit call: like b++;} — *end example*] [2](#2) [#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/overloading.tex#L3765) A [*decrement operator function*](#def:operator_function,decrement "12.4.7 Increment and decrement [over.inc]") is a function named operator-- and is handled analogously to an increment operator function[.](#2.sentence-1) [107)](#footnote-107)[107)](#footnoteref-107) Callingoperator++ explicitly, as in expressions likea.operator++(2), has no special properties: The argument tooperator++ is2[.](#footnote-107.sentence-1)