Answer:
See explaination
Explanation:
#include <iostream>
using namespace std;
class Circle{
// private member variable named radius
private:
double radius;
// get function for radius
public:
double getRadius(){
return radius;
}
// set function for radius
void setRadius(double rad){
radius=rad;
}
// returning area = 3.14159 * radius * radius
double getArea(){
return (3.14159 * radius * radius);
}
};
// Sample run
int main()
{
// Declaring object of Circle
Circle myCircle;
myCircle.setRadius(5);
// printing radius of circle
cout<<"Radius of circle is: "<<(myCircle.getRadius())<<endl;
// printing area of circle
cout<<"Area of circle is: "<<(myCircle.getArea())<<endl;
return 0;
}