Skip to main content

17.9) Exercise 27


In a file called circle.cpp, implement the Circle class defined in circle.hpp. Make sure that your circle.cpp file contains an include directive for circle.hpp. Remember to use the correct prefix for all methods in the implementation file; if you don’t do this, they will be considered as ordinary functions rather than methods of the class!

Note that the value of π will be available to you as constant M_PI if you add #include <cmath> to the include directives at the top of the file.

Check your code for syntax errors by using g++ -c to compile circle.cpp into object code form. If you see no messages of any kind, compilation has been successful.