请问这一串代码有什么问题

#include
using namespace std;
class point{
private:
float x,y;
public:
point(){
cin>>x>>y;
}
void move(float xoff,float yoff){
x=x+xoff;
y=y+yoff;
}
float getx(){ return x;
}
float gety(){ return y;
}
};
class rectangle:public point{
private:
float w,h;
public:
rectangle(){
cin>>w>>h;
}
float geth(){
return h;
}
float getw(){
return w;
}
};
int main(){
point a; rectangle w;
float ww,dd;
cin>>ww>>dd;
a.move(ww,dd);
a.getx();a.gety();
w.geth(); w.getw();
cout<<a.getx()<<" "<<a.gety()<<w.geth()<<w.getw()<<endl;
return 0;
}

不要在类的构造函数里cin输入数据,你这样写point a;的时候调用一次point类的构造函数, cin一次,然后rectangle w;的时候调用一次point类的构造函数,cin一次,调用rectangle类的构造函数,cin一次,然后main函数又cin一次,总共4次。
构造函数要这样写:

point(float x_in, float y_in):x(x_in),y(y_in){}
rectangle(float x_in, float y_in, float w_in, float h_in):point(x_in, y_in), w(w_in), h(h_in){}

然后主函数实例化的时候可以写成:

cin>>x_in>>y_in;
point a(x_in, y_in);
cin>>x_in>>y_in>>w_in>>h_in;
rectangle w(x_in, y_in, w_in, h_in);