Overloading the increment (and decrement) operator creates a slight problem: there are two version of each operator,
as they may be used as postfix operator (e.g., x++) or as prefix operator (e.g., ++x).
Suppose we define a class iterator whose members can be used to visit the elements of an array. The iterator object
will return a pointer [...]
Archive for the ‘Operator Overloading’ Category
Overloading ++ and –
Posted in Operator Overloading, Tutorials
Overloading operator delete(void *)
The delete operator may be overloaded too. The operator delete must have a void * argument, and an optional second
argument of type size_t, which is the size in bytes of objects of the class for which the operator delete is overloaded.
The returntype of the overloaded operator delete is void.
Therefore, in a class the operator delete [...]