求助。。。定义一个类,调试有错误。
错误为:float Circle::getRadius(void)”: “Circle”中没有找到重载的成员函数。。。 “float Circle::area(void)”: “Circle”中没有找到重载的成员函数类Point是已经定义好的基类。
class Circle:public Point
{
protected:
float radius;
public:
Circle(float x=0,float y=0,float r=0);
void setcircle(float);
float getRadius() const;
float area() const;
friend ostream &operator<<(ostream&output,Circle &c);
};
Circle::Circle(float a,float b,float r):Point(a,b),radius(r){}//设置半径
void Circle::setcircle(float r)
{ radius=r;}
float Circle::getRadius()
{return radius;}
float Circle::area()
{ return 3.141*radius*radius;}
ostream &operator<<(ostream&output,Circle &c)
{output<<"Center=["<<c.x<<","<<c.y<<"],r="<<c.radius<<",area="<<c.area()<<endl;
return output;
}