建立一个point ( 点 )类,包含数据成员x,y ( 坐标点

2024-12-02 23:27:45
推荐回答(1个)
回答(1):

class point {
int x, y;
public:
point( int _x, int _y ) { x = _x; y = _y; }
};

class circle : public point {
int r;
public:
circle( int x, int y, int _r ) : point(x,y) { r = _r; }
};

class cylinder : public circle {
int h;
public:
circle( int x, int y, int h ) : point( x, y ), circle( r ) {}
};