1. Built-in && and | | The operator has a "short-circuit evaluation" feature. For && if the first operand is true, then && returns to true, no longer evaluates the second operand, | | Instead, use this feature to write the following code:
Char *p; .. if (p>0&&strlen (P) >) ...
View Code
Once overloaded,&& and | | The left and right operand is two no points before and after the parameters, that is, the characteristics of short-circuit evaluation is not when the function is called, all parameters are evaluated and passed in and C + + does not specify a parameter of the job order, the previous code can not be used.
2. For the built-in comma operator, evaluate each operand from left to right, and finally return the rightmost operand (can be multiple commas) with
Once overloaded, the attributes that are evaluated from left to right are also gone (even if the overloads are the same as the member functions).
3. Operators that cannot be overloaded:
. .* :: ?:
New Delete sizeof typeID
static_cast dynamic_cast const_cast reinterpret_cast
More effective C + + clause 70 million do not overload &&,| | And, operator