Hi this is my problem
Define a class Circle that stores the center and radius of a circle, by keeping the numbers in a dynamically allocated array of doubles.
Supply the "big three" memory management functions. Use this class to demonstrate
(a) the difference between initialization
Circle s;
Circle t = s;
and assignment operation
Circle s;
Circle t;
s = t;
(b) the fact that all constructed objects are automatically destroyed
© the fact that the copy constructor is invoked if an object is passed by value to a function
(d) the fact that the copy constructor is not invoked when a parameter is passed by reference
(e) the fact that the copy constructor is used to copy a return value to the caller.
Supply a member functions that calculate the perimeter and the area of the circle. Overload the ++ operator (prefix and postfix forms) that add 1 to the radius of the circle and the > operator (with boolean return value) to compare two circles with respect to their areas. Overload the stream operators << and >>. Demonstrate all these functions and operators.

this is my try :

this is Circle Interface

class Circle: {

public:
   Circle(int newx, int newy, int newradius);
   void setRadius(int newradius);
   void draw();

   virtual void draw();

private:
   double* data = new double[3]
};

this is Circle Implementation

#include "Circle.h"
#include <iostream>

// constructor
Circle::Circle(int newx, int newy, int newradius): Shape(newx, newy) {
   setRadius(newradius);
}

// accessors for the radius
int Circle::getRadius() { return radius; }
void Circle::setRadius(int newradius) { radius = newradius; }

// draw the circle
void Circle::draw() {
  cout << "Drawing a Circle at:(" << getX() << "," << getY() <<
      "), radius " << getRadius() << endl;
}

// constructor
Circle::Circle(int newx, int newy) {
   moveTo(newx, newy);
}

// accessors for x & y
int Circle::getX() { return x; }
int Circle::getY() { return y; }
void Circle::setX(int newx) { x = newx; }
void Circle::setY(int newy) { y = newy; }

// move the Circle position
void Circle::moveTo(int newx, int newy) {
   setX(newx);
   setY(newy);
}
// abstract draw method
void Circle::draw() {
}

you have shape declared in you circle constructor but you don't have circle derived from shape. also you do not have a destructor and you will need one since this class uses dynamic memory. You also have a bunch of methods defined but not declared. maybe this is because you are trying to inherit from the shape class?

I'm totally stuck and I was very dull everything. Program simply to satisfy the condition above and what I tried to do something I obviously its lame. Please help

This article has been dead for over six months. Start a new discussion instead.