May 2002
Beginner
320 pages
6h 18m
English
Picking the data type or class that will be at the core of your program or class can be difficult.
For instance, the calculator used ints until it was revealed that there were arithmetic problems as a result of that choice. You might recall from Lesson 4, “Numeric Input,” that changing the calculator to use floats instead of ints forced modifications affecting almost every part of the code.
Changing the object-oriented calculator to use long double instead of float for greater accuracy would be no different: It would require changes in every class. And if you wanted to have an int calculator, a float calculator, and a long double calculator all at the same time, you might have to reimplement the classes used ...
Read now
Unlock full access