May 2012
Intermediate to advanced
679 pages
16h 56m
English
We have seen overloading unary operators. As increment and decrement operators are unary operators, we can overload them. However, their overloading is bit special. These operators come in both prefix and postfix form. To differentiate between pre- and post-increment, C++ has developed additional form. It uses a dummy parameter declaration “int”. Let us study overloading increment operator for rational numbers.
The declaration
In mathematics, we define a number as integer, real, rational, irrational or imaginary. Rational numbers are represented by a ratio of two integer numbers. ...
Read now
Unlock full access