c++ - prefix operator overloading -
I overload the But my suspicions arise when I use it for my object below: As far as I know that the operator is exaggerated by the any operator for on the left but when that operator I'm calling this Why? So far I have learned that for any operators overloaded by any member operator The object of the same category on the left side of that operator should be one. This will be pre-and post-indentment for any binary operator, as well as a direct operator ( But when I am calling this ++ prefix surcharge operator, then I do not need any of the test class on the left side. Unir operators have "left" and "not correct" side (operand), they only have one operand. Remember in your case: means only: So - in some twisted thinking - ++ prefix operator using a member function. Here's the prototype:
test and operator ++ ();
test t; ++ t;
++ prefix overloaded operator, so I do not need any object in class
test on the left.
* obj ) operators Are there. They have an argument (either a function parameter or contained "this" parameter, how you overload the operator) and for overloaded operators it should be only one class type.
++ t;
T. Operator ++ ();
t is actually on the left :)
Comments
Post a Comment