18.2) Exercise 29
- Modify your solution to Exercise 28 so that the
Circle
object is declared asconst
, e.g. - Make the methods of your
Circle
classconst
. Remember to add theconst
to the prototypes in circle.hpp and the method implementations in circle.cpp. Remember that the constructor cannot, by definition, beconst
. Compile the class implementation file, then try to compile your program.
const Circle c(x, y, radius);
Try compiling the program. You should see errors.