Output
circle1
circle1: Circle
radius: random value
circle2
circle2: Circle
radius: random value
circle3
circle3: Circle
radius: random value
Variable Name     Value in Memory
number1
number2
answer
  1  #include <iostream>
  2  using namespace std;
  3  
  4  class Circle
  5  {
  6  public:
  7    // The radius of this circle
  8    double radius;
  9  
 10    // Construct a default circle object
 11    Circle()
 12    {
 13      radius = 1;
 14    }
 15  
 16    // Construct a circle object
 17    Circle(double newRadius)
 18    {
 19      radius = newRadius;
 20    }
 21  
 22    // Return the area of this circle
 23    double getArea()
 24    {
 25      return radius * radius * 3.14159;
 26    }
 27  };  // Must place a semicolon here
 28  
 29  int main()
 30  {
 31    Circle circle1(1.0);
 32    Circle circle2(25);
 33    Circle circle3(125);
 34  
 35    cout << "The area of the circle of radius "
 36      << circle1.radius << " is " << circle1.getArea() << endl;
 37    cout << "The area of the circle of radius "
 38      << circle2.radius << " is " << circle2.getArea() << endl;
 39    cout << "The area of the circle of radius "
 40      << circle3.radius << " is " << circle3.getArea() << endl;
 41  
 42    // Modify circle radius
 43    circle2.radius = 100;
 44    cout << "The area of the circle of radius "
 45      << circle2.radius << " is " << circle2.getArea() << endl;
 46  
 47    return 0;
 48  }