Question: A Circle class has a data member called radius and the following functions: a default constructor that initializes the radius to 1.0 a constructor that
A Circle class has a data member called radius and the following functions: a default constructor that initializes the radius to 1.0 a constructor that takes a double parameter and initializes the radius to that value a get method (getRadius) that just returns the value of the radius a set method (setRadius) that takes a double parameter and sets the radius to that value a method called area that takes no parameters and returns the area of the Circle a method called perimeter that takes no parameters and returns the perimeter of the Circle You should write that same Circle class, but in separate interface (Circle.hpp) and implementation (Circle.cpp) file. Your .hpp file should contain the data members and prototypes, while your .cpp file should contain the function definitions. Your .cpp file will need to #include "Circle.hpp" (note that quotation marks are used for local files instead of the angle brackets you're used to). Also, when defining the functions in the .cpp class, you will need to add "Circle::" in front of the function name in the header for each function. The #infndef, #define, and #endif directives in the Rectangle example are "include guards". They prevent a header file from being included more than once. For your .hpp file it will look the same as in the Rectangle example, except that you will change "RECTANGLE_H" to "CIRCLE_HPP". Your main function will also go in a separate file, and it will also need to #include "Circle.hpp". You will compile your Circle class with your main function something like this: "g++ Circle.cpp circleMain.cpp -o circle". Note that you don't need to list the .hpp file in the compile command. You can use the following main function to test your Circle class:

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
