EX9_03.CPP (Exercising the overloaded 'greater than' operator) works as it should.
However, on page 337, Ivor incorrectly states that this code will not work:
In fact, this code does
work, and does not
give any errors.
To refresh your memory, the reason the code was not supposed to work was because the overloaded operator ">" can only deal with comparing two CBox objects, not one CBox ojbect versus a float value.
This is why it works:
The constructor and destructor is called and a new CBox object is created! Its volume equals the 20.0 float value! It is this object that is compared to aBox! The dimensions of this box is lv = 20.0, bv = 1.0, and hv = 1.0. Once it is done, the CBox object is destroyed.
(There exists the possibility that it works because my verson of MSVC++ is 7, and not 6. Perhaps this did not work in version 6, but I believe it will
"Discussion is an exchange of knowledge; argument is an exchange of ignorance."