M
MiKy
I am getting this error:
Illegal indirection at line : a[*count_circle].SetArea(p1);
Is it possible to set an object in an array like I am trying to do ?
void CreateCircle(Circle* a, int count_circle)
{
float x,y,c, z;
cout<<" Enter the Center Point of the circle, X-Axis: " ;
cin>> x ;
cout<<endl;
cout<<" Enter the Center Point of the circle, Y-Axis: " ;
cin>> y ;
cout<<" Enter the Color of that point: " ;
cin>> c ;
cout<<" Enter the radius of the circle: " ;
cin>> z;
cout<<endl;
Circle p1( (x,y,c),z);
a[*count_circle].SetArea(p1);
}
my class circle:
class Circle: public Shape
{
public:
Circle(){};
Circle(Point p, float r) : Shape(p) {radius = r;
cout<<"radius :" << radius; }
void SetArea(Circle) {area= PI * ( pow(radius,2) ); }
float GetArea(){ return area; }
private:
float radius;
float area;
};
Illegal indirection at line : a[*count_circle].SetArea(p1);
Is it possible to set an object in an array like I am trying to do ?
void CreateCircle(Circle* a, int count_circle)
{
float x,y,c, z;
cout<<" Enter the Center Point of the circle, X-Axis: " ;
cin>> x ;
cout<<endl;
cout<<" Enter the Center Point of the circle, Y-Axis: " ;
cin>> y ;
cout<<" Enter the Color of that point: " ;
cin>> c ;
cout<<" Enter the radius of the circle: " ;
cin>> z;
cout<<endl;
Circle p1( (x,y,c),z);
a[*count_circle].SetArea(p1);
}
my class circle:
class Circle: public Shape
{
public:
Circle(){};
Circle(Point p, float r) : Shape(p) {radius = r;
cout<<"radius :" << radius; }
void SetArea(Circle) {area= PI * ( pow(radius,2) ); }
float GetArea(){ return area; }
private:
float radius;
float area;
};