永发信息网

这个c++程序怎么运行

答案:1  悬赏:60  手机版
解决时间 2021-05-01 16:30
  • 提问者网友:心如荒岛囚我终老
  • 2021-05-01 01:33

class Location
{ private :
double x;
double y;
public:
Location(double_x,double_y);
void move(double_nx,double_ny);
};
class Point:Public Location
{
public:
Point(double_x,double_y):Location(_x,_y)
{x=_x;y=_y;
}
void draw()
{ count<<"Point("<<x<<","<<y<<")\n";
}
};
class Circle:public point
{
private:
double r;
public:
Circle(double_x,double_y,double r):Point(_x)
{
r=_r;
}
void draw()
{
cout<<"draw circle"<<endl;
}
void main()
{point P(3,4);
P.draw();
P.move();
P.draw()
Circle c(1,1,2);
}

最佳答案
  • 五星知识达人网友:轻雾山林
  • 2021-05-01 02:50

#include<iostream.h>
class Location
{ private :
double x;
double y;
public:
Location(double _x,double _y);
void move(double _nx,double _ny){x=x-_nx;y=y-_ny;};
};
class Pointx:public Location
{
private:double x,y;
public:

Pointx(double _x,double _y):Location( _x, _y)
{
x=_x;y=_y;
}

};
class Circle: Pointx
{
private:
double r,y,x;
public:
Circle(double _x,double _y,double r):Pointx(_x,_y)
{
x=_x;y=_y;
}
void draw()
{
cout<<"draw circle"<<endl;
}
};
void main()
{Pointx P(3,4);
//P.draw();
P.move(3,4);
//P.draw();
Circle c(1,1,2);
}


我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯