Usually, postfix and prefix operator overloading is defined as follows,
My question is that why prefix returns by value and postfix returns by reference?Code:class Number { public: Number& operator++ (); // prefix ++ Number operator++ (int); // postfix ++ };




Reply With Quote