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() {
}